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

Hide the menu with jquery does not work in IE

本文关键字:不起作用 IE jquery 隐藏菜单 使用      更新时间:2023-09-26

菜单应该根据浏览器窗口的大小隐藏或显示,但在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');
    });
  }
});

对不起,如果你不明白,我几乎不会说英语

向大家致以问候兹利小丑102

负边距在IE中不起作用。使用位置:相对和左侧:-315

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