javascript - Can't get the scrollTo jQuery effect to work -
I have problems implementing one page navigation and scrollTo JQuery Plugins (looks like I need more prestige to post links, so I hope you know what plug-in I'm mentioning). I am making a complete start up for javascript and I just want the link to my navigation bar for a scrolling effect I have pasted the full code of my HTML page because I'm not sure I Where's the wrong? For now I have left in the plugins created from the functions (although I have tried only with one - and also tried to link it with 'div # nav', '#navbar', etc.). Use But if you want to alert or scroll on a specific element, you can In your code, you will see your code as Back to top css & lt; Html & gt; & Lt; Top & gt; & Lt; Meta charset = "UTF-8" & gt; & Lt; Title & gt; Deepeedesigns - Web site designer Dan Pearce's portfolio site & lt; / Title & gt; & Lt; Link rel = "icon" type = "image / png" href = "" & gt; & Lt ;! - Favicon - & gt; & Lt; Meta name = "description" content = "" & gt; & Lt ;! - Details that appear under Google Listing - & gt; & Lt; Meta name = "keyword" content = "" & gt; & Lt; Meta name = "robot" content = "" & gt; & Lt; Link rel = "stylesheet" type = "text / css" href = "css / stylesheet.css" & gt; & Lt; script src = "http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" & gt; & Lt; / Script & gt; & Lt; Script src = "js / jquery.scrollTo.js" & gt; & Lt; / Script & gt; & Lt; Script src = "js / jquery.nav.js" & gt; & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div id = "header" & gt; & Lt; Div class = "container" & gt; & Lt; Div id = "navbar" & gt; & Lt; Div id = "logo" & gt; & Lt; Img src = "picture / logo.png" & gt; & Lt; / Div & gt; & Lt; Ul id = "nav" & gt; & Lt; Li & gt; & Lt; A href = "# home" & gt; Home & lt; / A & gt; & Lt; / li & gt; & Lt; Li & gt; & Lt; A href = "about #" & gt; About & lt; / A & gt; & Lt; / li & gt; & Lt; Li & gt; & Lt; A href = "# portfolio" & gt; Portfolio & lt; / A & gt; & Lt; / li & gt; & Lt; Li & gt; & Lt; A href = "# contact" & gt; Contact & lt; / A & gt; & Lt; / li & gt; & Lt; / Ul & gt; & Lt; / Div & gt; & Lt ;! - Navbar - & gt; & Lt; / Div & gt; & Lt ;! - Container - & gt; & Lt; / Div & gt; & Lt ;! - Header - & gt; & Lt; Div id = "home" & gt; & Lt; div class = "background" & gt; & Lt; Div class = "container" & gt; & Lt; / Div & gt; & Lt ;! - Container - & gt; & Lt; / Div & gt; & Lt ;! - background - & gt; & Lt; / Div & gt; & Lt ;! - Home - & gt; & Lt; div id = "about" & gt; & Lt; div class = "background" & gt; & Lt; Div class = "container" & gt; & Lt; / Div & gt; & Lt ;! - Container - & gt; & Lt; / Div & gt; & Lt ;! - background - & gt; & Lt; / Div & gt; & Lt ;! - About - & gt; & Lt; Div id = "portfolio" & gt; & Lt; div class = "background" & gt; & Lt; Div class = "container" & gt; & Lt; / Div & gt; & Lt ;! - Container - & gt; & Lt; / Div & gt; & Lt ;! - background - & gt; & Lt; / Div & gt; & Lt ;! - Portfolio - & gt; & Lt; Div id = "contact" & gt; & Lt; div class = "background" & gt; & Lt; Div class = "container" & gt; & Lt; / Div & gt; & Lt ;! - Container - & gt; & Lt; / Div & gt; & Lt ;! - background - & gt; & Lt; / Div & gt; & Lt ;! - Contact - & gt; $ (Document) .ready (function () {$ ('# nav'). OnePageNav ();}); $ (Document) .ready (function () {$ ('# nav'). $ ScrollTo ();}); & Lt; / Body & gt; & Lt; / Html & gt;
Jquery to scroll you to the top There is no need to do You can use it on the
window object
window.scrollTo (0,0);
jquery
$ (" Html, body "). Chetan ({scrollTop: 0}, "slow");
& lt; Script & gt; & Lt; / Script & gt;
$ scrollTo
> Is a spelling mistake of scrollTo HTML
& lt; A class = "btn-go-top" href = "javascript: window.scrollTo (0,0);" & Gt; Go to the top & lt; / A & gt;
.btn-go-top {position: fixed; Bottom: 20px; Correct: 20px; }
Comments
Post a Comment