jQuery .animate()marginLeft在IE8及以下版本中无效 - 参数无效 [英] jQuery .animate() marginLeft not working in IE8 and below - invalid argument

查看:325
本文介绍了jQuery .animate()marginLeft在IE8及以下版本中无效 - 参数无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个IE特定的问题。从好的方面来说,它适用于所有其他浏览器。

I have an IE specific problem. On the bright side it works well on all other browsers.

单击 .close_button_page 图像时会出现问题应执行简单的动画功能,将 div 移到左侧。

The problem occurs when clicking the .close_button_page image which should perform the simple animate function, moving the div to the left.

在IE 8及以下版本中,它只是简单的在控制台中说无效参数。我在网上发现了这样的问题,但没有解决问题。

In IE 8 and below, it simply says invalid argument in the console. I have found issues like this online but none address the problem.

注意:还有很多其他IE漏洞( z-index etc)目前请忽略它。

Note: There are many other IE bugs (z-index etc) at the moment so please ignore that.

HTML:

<div id="content-left">
    <img class="close_button_page" height="13" width="14" src="assets/images/close_button.png"/>
    <h2>Our process</h2>
    <h3>Even smaller title to this section</h3>
    <p>Dummy text to show that this is the home of Dukelease and that this site is of the utmost quality and will provide hours of fun by flicking through images.</p>
</div>

CSS:

#content-left {
  -webkit-box-shadow:#000000 1px 1px 5px;
  border-top-color:#FFFFFF;
  border-top-style:solid;
  border-top-width:3px;
  box-shadow:#000000 1px 1px 5px;
  float:left;
  padding-bottom:10px;
  padding-left:10px;
  padding-right:10px;
  padding-top:10px;
  position:relative !important;
  width:230px;
  z-index:10;
}
style.css (line 562)
#content-left, .bg_white {
  background-color:rgba(255, 255, 255, 0.949219);
}

JavaScript:

$(".close_button_page").click(function(){   

    $('#content-left').animate({
        marginLeft: '-260px'
    }, 1300, function(){
        $('.open_button_page').fadeIn(1000);
    });             
});


推荐答案

尝试替换此:

$(".close_button_page").click(function(){   

    $('#content-left').animate({
        marginLeft: '-260px'
    }, 1300, function(){
        $('.open_button_page').fadeIn(1000);
    });             
});

这个:

$(".close_button_page").click(function(){ 
    $('#content-left').toggle('slide');
});

此处经过测试 http://jsfiddle.net/ollie101/RuVZ3/5/

这篇关于jQuery .animate()marginLeft在IE8及以下版本中无效 - 参数无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆