gpt4 book ai didi

javascript - 用 jquery 隐藏菜单在 IE 中不起作用

转载 作者:行者123 更新时间:2023-11-28 08:55:09 26 4
gpt4 key购买 nike

菜单应根据浏览器窗口的大小隐藏或显示,但在 Internet Explorer 中不起作用。我使用了这个 jquery,如果有人能告诉我它写得不好吗???

$(window).resize(function() {
if(viewport()<767){

$('.buttonShow').on('click', function(e){
e.preventDefault();

$('.slide-menu').stop().animate({marginLeft: '0'});
$('.brand').stop().animate({marginRight: '0'});
$(this).hide();
$('.buttonHide').show();
if(viewport()<383){
$('.slide-menu').css('width','100%')
}
});

$('.buttonHide').on('click', function(e){
e.preventDefault();

$('.slide-menu').stop().animate({marginLeft: '-315'});
/*$('.brand').stop().animate({marginRight: '-436'});*/
$(this).hide();
$('.buttonShow').show();
$('.slide-menu').css('width','368');
});
}

});

对不起,如果你没听懂,我几乎不会说英语

大家好zlyjoker102

最佳答案

负边距在 IE 中不起作用。使用 position:relative 和 left:-315

$('.slide-menu').stop().animate({left: '-315'});
$('.slide-menu').stop().animate({position: 'relative'});

关于javascript - 用 jquery 隐藏菜单在 IE 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27158394/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com