[JavaScript] jQuery动态设置元素宽度和高度 →→→→→进入此内容的聊天室

来自 , 2019-11-26, 写在 JavaScript, 查看 101 次.
URL http://www.code666.cn/view/df7e148c
  1. jQuery.fn.animateAuto = function(prop, speed, callback){
  2.     var elem, height, width;
  3.     return this.each(function(i, el){
  4.         el = jQuery(el), elem = el.clone().css({"height":"auto","width":"auto"}).appendTo("body");
  5.         height = elem.css("height"),
  6.         width = elem.css("width"),
  7.         elem.remove();
  8.        
  9.         if(prop === "height")
  10.             el.animate({"height":height}, speed, callback);
  11.         else if(prop === "width")
  12.             el.animate({"width":width}, speed, callback);  
  13.         else if(prop === "both")
  14.             el.animate({"width":width,"height":height}, speed, callback);
  15.     });  
  16. }
  17.  
  18.  
  19.  
  20. //javascript/4238

回复 "jQuery动态设置元素宽度和高度"

这儿你可以回复上面这条便签

captcha