Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.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/7/css/43.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
Jquery firefox和opera在定位上有问题_Jquery_Css - Fatal编程技术网

Jquery firefox和opera在定位上有问题

Jquery firefox和opera在定位上有问题,jquery,css,Jquery,Css,我使用的是一个典型的位置:固定的“滚动到顶部”链接,通过jquery,手动向下滚动时淡入淡出,手动向上滚动时淡出淡出。单击链接时,它会将scrollTop的用户动画显示到站点顶部 css的问题是,当您在opera或firefox中单击链接时,css会从底部:10px切换到顶部:0px,除非您再次单击,否则不会出现scrollTop 如果在样式表中将其更改为top:0,则链接可以正常工作。但是试一下bottom:10px(或者除top:0以外的任何东西),点击它的动作会导致它再次变为top:0。

我使用的是一个典型的位置:固定的“滚动到顶部”链接,通过jquery,手动向下滚动时淡入淡出,手动向上滚动时淡出淡出。单击链接时,它会将scrollTop的用户动画显示到站点顶部

css的问题是,当您在opera或firefox中单击链接时,css会从底部:10px切换到顶部:0px,除非您再次单击,否则不会出现scrollTop

如果在样式表中将其更改为top:0,则链接可以正常工作。但是试一下bottom:10px(或者除top:0以外的任何东西),点击它的动作会导致它再次变为top:0。 就好像FF&O不允许除top:0px之外的任何东西

有什么想法吗

这是CSS-

a#scrollup{
display:none;
width:51px;
height:51px;
-moz-opacity:.7;
opacity:.7;
zoom:1;
filter:alpha(opacity=70);
position:fixed;
overflow:hidden;
text-indent:100%;
white-space: nowrap;
z-index:1001;
bottom:10px;
right:10px;
background: url('images/ui.totop.png') no-repeat;
-webkit-transition:opacity 0.8s ease-in-out;
   -moz-transition:opacity 0.8s ease-in-out;
    -ms-transition:opacity 0.8s ease-in-out;
     -o-transition:opacity 0.8s ease-in-out;
        transition:opacity 0.8s ease-in-out;
}

a#scrollup:hover{
-moz-opacity:.9;
opacity:.9;
filter:alpha(opacity=90);
}
a#scrollup:active{bottom:8px}
这是剧本-

    $(window).scroll(function(){
        if ($(this).scrollTop() > 100) {
            $('a#scrollup').fadeIn();
        } else {
            $('a#scrollup').hide('fast');  
        }
    }); 

    $('a#scrollup').click(function(){
        $("html, body").animate({ scrollTop: 0 }, 600, 'easeInExpo');
        return false;
    });

好的,我能想到的唯一修复方法是给锚一个div包装,然后应用 位置:固定,底部:10像素到它,而不是到锚/链接

新CSS:

div#scrollup {
display:none;
position:fixed;
z-index:1001;
bottom:10px;
right:10px;
}

div#scrollup a{
overflow:hidden;
text-indent:100%;
white-space: nowrap;
width:51px;
height:51px;
-moz-opacity:.7;
opacity:.7;
zoom:1;
filter:alpha(opacity=70);
background: url('images/ui.totop.png') no-repeat;
-webkit-transition:opacity 0.8s ease-in-out;
   -moz-transition:opacity 0.8s ease-in-out;
    -ms-transition:opacity 0.8s ease-in-out;
     -o-transition:opacity 0.8s ease-in-out;
        transition:opacity 0.8s ease-in-out;
}

div#scrollup a:hover{
-moz-opacity:.9;
opacity:.9;
filter:alpha(opacity=90);
}
div#scrollup a:active{bottom:8px}
修改jquery:

     $(window).scroll(function(){
        if ($(this).scrollTop() > 100) {
            $('div#scrollup').fadeIn();
        } else {
            $('div#scrollup').hide('fast');  
        }
    }); 

    $('div#scrollup a').click(function(){
        $("html, body").animate({ scrollTop: 0 }, 600, 'easeInExpo');
        return false;
    });
所以它需要一个包装