窗口大小调整后处理事件jQuery插件ResizeEnd
需要引入的文件:
<script src="js/jquery.min.js"></script> <script src="js/jQuery.resizeEnd.min.js"></script>
代码调用:
$(function(){ $(window).on('resize', function() { $('.txt h3').text('调整中'); }); $(window).resizeEnd({ delay : 500 }, function(){ var $body = $('body'); var $ww = $(window).width(); if($ww > 1500){ $body.removeClass(); } else if($ww < 1500 && $ww > 1000){ $body.attr('class', 'window-width-1000-to-1500'); } else if($ww < 1000){ $body.attr('class', 'window-width-lt1000'); } $('.txt h3').text('调整完成'); }); $(window).resizeEnd(); });
参考网址:http://www.dowebok.com/demo/119/