0
我在magento管理员存储中看到了此工具栏。在页面向下滚动并且菜单消失之后,我想要一个顶部工具栏以透明背景的形式出现,就像前面提到的管理面板中一样。滚动后的顶部工具栏,在jQuery
我在magento管理员存储中看到了此工具栏。在页面向下滚动并且菜单消失之后,我想要一个顶部工具栏以透明背景的形式出现,就像前面提到的管理面板中一样。滚动后的顶部工具栏,在jQuery
的HTML:
<div class="auto-style1">
<a href="#top" id="top-link">Top of Page</a>
</div>
的CSS:
.auto-style1 { text-align: right;}
的JavaScript:
jQuery.fn.topLink = function(settings)
{
settings = jQuery.extend({
min: 1,
fadeSpeed: 200
}, settings);
return this.each(function() {
//listen for scroll
var el = $(this);
el.hide(); //in case the user forgot
$(window).scroll(function() {
if($(window).scrollTop() >= settings.min)
{
el.fadeIn(settings.fadeSpeed);
}
else
{
el.fadeOut(settings.fadeSpeed);
}
});
});
};
//usage w/ smoothscroll
$(document).ready(function() {
//set the link
$('#top-link').topLink({
min: 400,
fadeSpeed: 500
});
//smoothscroll
$('#top-link').click(function(e) {
e.preventDefault();
$.scrollTo(0,300);
});
});
作品。皮毛进一步参考:http://davidwalsh.name/jquery-top-link – Nogard