1
因此,標題有點寬泛。我有這個功能,在鼠標/頁面滾動(頁面大約88px)的位置,「菜單將更改爲靜態位置,因此它保持在瀏覽器窗口之上...固定滾動功能....希望它滑動(JQUERY)
很像這樣...對不起,我的HTML是一個框架,不能輕易共享。 http://www.1stwebdesigner.com/wp-content/uploads/2010/06/nagging-menu-with-css3-and-jquery/index.html
然而,我的沒有做任何幻想(不喜歡上面的演示一樣)。我想我的OT耽誤一下,然後滑下排序的。像演示。
這裏是我的jQuery函數...任何人?
var div = $('#wizMenuWrap');
var editor = $('#main_wrapper');
var start = $(div).offset().top;
$(function fixedPackage() {
$(window).bind("scroll", function() {
// If the modal is displayed, do nothing
if ($('.modal').is(':visible'))
return;
var p = $(window).scrollTop();
$(div).css('position', ((p) > start) ? 'fixed' : 'static');
$(div).css('top', ((p) > start) ? '0px' : '');
//Adds TOP margin to #main_wrapper (required)
$(editor).css('position', ((p) > start) ? 'relative' : 'static');
$(editor).css('top', ((p) > start) ? '88px' : '');
});
});