[英]Javascript moving divs around doesn't work on iPad
I am using this script to move around some divs: 我正在使用此脚本在一些div上移动:
<script type="text/javascript">
onresize=onload=function() {
if ($(window).width() < 768) {
$("#MainContent").insertAfter($("#ImageSlider"));
$("#Menu").insertBefore($("#TopBanner"));
} else {
$("#MainContent").insertBefore($("#ImageSlider"));
$("#Menu").insertBefore($("#Footer"));
}
};
</script>
Which is working nicely except on an iPad. 除了在iPad上之外,其他都运行良好。 Any ideas what I'm doing wrong?
有什么想法我做错了吗?
Try "screen.width" 尝试“ screen.width”
<script type="text/javascript">
onresize=onload=function() {
if (screen.width < 768) {
$("#MainContent").insertAfter($("#ImageSlider"));
$("#Menu").insertBefore($("#TopBanner"));
} else {
$("#MainContent").insertBefore($("#ImageSlider"));
$("#Menu").insertBefore($("#Footer"));
}
};
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.