我遇到了一個我試圖實施的粘性導航/橫幅圖像二重奏的問題。 看看這裏:http://lucid-build.com/stack/sticky/ 問題是,當我調整窗口的大小,橫幅的位置是關閉的。否則,它就像它應該的那樣行事。 關於如何解決這個問題的任何建議將不勝感激!關閉窗口中的橫幅位置用粘滯導航調整大小
[編輯]這是劇本!
function resizeBanner() {
var bannerH = $(".banner img").height();
$(".banner").css("height", bannerH);
}
function fixedNav() {
var logoT = $(".logo").offset().top;
var bannerH = $(".banner img").height();
$(window).scroll(function() {
if($(window).scrollTop() > logoT) {
$("#header").addClass("fixed").css(("height"),120);
$(".banner").css(("margin-top"),-bannerH+120);
$("body").css(("margin-top"),bannerH+18);
} else {
$("#header").removeClass("fixed").css(("height"),("auto"));
$(".banner").css(("margin-top"),0);
$("body").css(("margin-top"),0);
}
});
}
$(window).resize(function() {
resizeBanner();
});
$(window).load(function() {
resizeBanner();
fixedNav();
});
$(document).ready(function() {
resizeBanner();
});
我們簽出的任何代碼?這個粘性導航/橫幅實際上是如何粘性的? –
剛剛添加腳本到我原來的帖子! :) – angelwhite