admin管理员组文章数量:1327682
I have back-to-top script with an arrow icon which appears when scrolling down and disappears when the page content is on top. Works perfect, but when I insert the script in Wordpress the scrollTop
part of the script works but not the fade-in
and fade-out
effect.
Any solution?
(function($) {
$('body').prepend('<a href="#" class="back-to-top">Back to Top</a>');
var amountScrolled = 300;
$(window).scroll(function() {
if ( $(window).scrollTop() > amountScrolled ) {
$('a.back-to-top').fadeIn('slow');
} else {
$('a.back-to-top').fadeOut('slow');
}
});
$('a.back-to-top, a.simple-back-to-top').click(function() {
$('html, body').animate({
scrollTop: 0
}, 700);
return false;
});
}(jQuery));
body {background:#FEF1D4; height:1000px}
.back-to-top {
display: none;
width: 4.75rem;
height: 4.75rem;
text-indent: -9999px;
position: fixed;
z-index: 1500;
left: 0.5rem;
bottom: 1rem;
background: url(.png) no-repeat center 43%;
background-size: contain;
}
<script src=".3.1/jquery.min.js"></script>
Expected result → jsfiddle
Wordpress result ↓
本文标签: javascriptFadein Fadeout doesn39t work in Wordpress
版权声明:本文标题:javascript - Fade-in Fade-out doesn't work in Wordpress 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742214602a2434336.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论