2011-06-27 41 views

回答

2

像这样的东西应该让你开始。

$(window).resize(function() { 

     function smoothResize() { 

      // animate the width on resize 
      $('#container').animate({ 

       'width' : $(window).width()-15 

      }); 

     } 

     // This calls the function 'smoothResize' when the browser has finished resizing 
     clearTimeout(this.id); 
     this.id = setTimeout(smoothResize, 50); 

    }); 

您需要一些if来检测屏幕大小以及div是否在约束范围内并需要调整大小。

+0

这很好,因此解决了。作为插件,我需要找到放置.animate函数的回调函数的位置,这将关闭BODY {}溢出,以便在平滑过渡期间没有滚动条可见。我也将获得easing插件来自己工作。 –

相关问题