sticky header

$(function(){ var $window = $(window), $content = $(".content"), $sticky = $(".sticky"), topContent = $content.offset().top; $window.on("scroll", function(){ if ($window.scrollTop() > topContent){ $sticky.slideDown(); }else{ $sticky.slideUp(); } }); $window.trigger("scroll"); }); 最後にtrigger使う理由がいまいち分からない

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.