这是我的代码。我想删除jScrollPane只Ipad的肖像,不需要重新加载页面。请帮帮我
$(window).resize( function(event){
var height = $(window).height();
var width = $(window).width();
if(width>height) {
var height = 0;
height = $(window).height()-129;
height = height-56-$('.titstyle04').height();
$('.mainimgmenuin .jscrollpane').css('height',height);
if($('.jscrollpane').length > 0){
$('.jscrollpane').jScrollPane();
}
}
else {
$(".jscrollpane").jScrollPane().data().jsp
}
});发布于 2017-09-20 12:59:31
$(窗口).on(“方向更改”,function () {
if (window.innerHeight > window.innerWidth) {
CallPortraitMail();
} else if (window.innerHeight < window.innerWidth) {
CallLandscapeMail();
}});
使用方向更改方法自定义您的代码。
发布于 2017-09-20 13:49:41
如果您更喜欢JavaScript/jQuery解决方案,这里有一个选项(在jQuery中):
$(function() {
var myInterval = setInterval(function() {
if(window.innerHeight > window.innerWidth){
$('.jscrollpan').hide();
}
if(window.innerHeight < window.innerWidth){
$('.jscrollpan').show();
}
},4);
});另外,可选的,你有没有在你的CSS中尝试过下面的内容(用这个代替上面的jQuery )?
@media all and (orientation:portrait) {
.jscrollpane {
display: none;
}
}https://stackoverflow.com/questions/46313581
复制相似问题