Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
绝对定位的元素不会在ie7中使用Jquery SlideToggle设置动画_Jquery_Html_Css_Internet Explorer 7 - Fatal编程技术网

绝对定位的元素不会在ie7中使用Jquery SlideToggle设置动画

绝对定位的元素不会在ie7中使用Jquery SlideToggle设置动画,jquery,html,css,internet-explorer-7,Jquery,Html,Css,Internet Explorer 7,我的HTML中有一个隐藏部分,它在使用JQuery的“slideToggle”功能按下按钮时显示和隐藏 这个按钮位于隐藏内容的下方,可以在除ie7之外的所有浏览器中轻松地进行动画制作,有没有一种方法可以在不重写按钮的情况下强制它进行动画制作,从而使其不处于绝对位置 <div class="hiddenContent"> <p>Hidden content is in here</p> </div> <div class="showmoreco

我的HTML中有一个隐藏部分,它在使用JQuery的“slideToggle”功能按下按钮时显示和隐藏

这个按钮位于隐藏内容的下方,可以在除ie7之外的所有浏览器中轻松地进行动画制作,有没有一种方法可以在不重写按钮的情况下强制它进行动画制作,从而使其不处于绝对位置

<div class="hiddenContent">
<p>Hidden content is in here</p>
</div>
<div class="showmorecontainer">
<a class="showmore" href="#">SHOW</a>
</div>
JQuery-

$(".showmore").click(function(e) {
    $(this).parent().parent().find('.hiddenContent').slideToggle('slow',      function() {
        if($(this).is(":hidden")){
            $(this).parent().find('.showmore').html('SHOW ME MORE');
            $(this).parent().find('.arrow').removeClass('arrowup');
        }
        else{
            $(this).parent().find('.showmore').html('CLOSE BACK UP');
            $(this).parent().find('.arrow').addClass('arrowup');
        }
    });
    e.preventDefault();
});

您没有提到IE7是否抛出任何错误,但如果是,您可能希望更仔细地检查它们。我目前没有访问IE7的权限来测试这一点,但我想知道是否更改这一行代码

$(this.parent().parent().find('.hiddenContent').slideToggle('slow',function(){

…为了这个

$(this).parents().find('.hiddenContent').slideToggle('slow',function(){


…可能会有帮助。

这似乎是IE7中CSS的一个问题。绝对定位的元素不会动画,而是跳到终点。我解决了这个问题,只是摆脱了绝对定位,改为使用负边距。

我们可以看到一些javascript和CSS吗?感谢您的尝试,但是JQuery中没有错误这似乎是IE7CSS的一个问题,我通过删除绝对位置并使用负边距来解决它
$(".showmore").click(function(e) {
    $(this).parent().parent().find('.hiddenContent').slideToggle('slow',      function() {
        if($(this).is(":hidden")){
            $(this).parent().find('.showmore').html('SHOW ME MORE');
            $(this).parent().find('.arrow').removeClass('arrowup');
        }
        else{
            $(this).parent().find('.showmore').html('CLOSE BACK UP');
            $(this).parent().find('.arrow').addClass('arrowup');
        }
    });
    e.preventDefault();
});