如果浏览器宽度 > 760 像素且小于 980 像素,我希望 Div 标签为空,但看起来我做错了什么
(function($){
//detect the width on page load
$(document).ready(function(){
var current_width = $(window).width();
//do something with the width value here!
if(current_width < 980 && current_width > 760){
$('#chwd').empty();
}
});
//update the width value when the browser is resized (useful for devices which switch from portrait to landscape)
$(window).resize(function(){
var current_width = $(window).width();
//do something with the width value here!
if(current_width < 980 && current_width > 760 ){
$('#chwd').empty();
}
else{
$('#chwd').html(
<div id="ahead">
<div class="column">
Cash On Delivery
</div>
</div>
);}
});
})(jQuery);
任何帮助,将不胜感激
谢谢