I tried to do this exactly but it does not work ...
& lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Link type = "text / css" rel = "stylesheet" href = "website.css" & gt; & Lt; Script src = "website.js" & gt; & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div class = "menu" & gt; Menu & lt; / Div & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Br / & gt; (Below!) & Lt; / Body & gt; & Lt; / Html & gt;
// website.css
. Menu {background: # 345; Color: #fff; Height: 2em; Padding: .5em; Status: Completed; Top: 50px; Width: 100%; } Fixed {status: fixed; Top: 0; }
// website.js
/ * dynamic top menu position * * / var number = 50; // Number of pixels before modifying the style $ (window) .bund ('scroll', function) (if ($ (window) .scrollTop ()> gt;) ($) ($. 'Menu') AddClass ('Fixed');} and {$ ('Menu'). RemoveClass ('fixed');}}); // It uses the scroll wheel for the Fidel demo
When I open this html file, why does not it work? I have to make such a navigation bar. Who can help me?
You did not include a reference to jQuery in your HTML, which is why
< Pre> & lt; Script src = "http://ajax.googleapis.com /ajax/libs/jquery/1.11.1/jquery.min.js"></script> & Lt; Script src = "website.js" & gt; & Lt; / Script & gt;
Comments
Post a Comment