javascript - Make <div> appear upon scrolling -
I'm new to JavaScript, so I'm sorry if after reading this mess, I started scrolling the user After implementing the code required to show a devil. When I put the code in JSFiddle ( ) it works perfectly. However, it does not work at all on my website. It's in JSFiddle, but this is my code:
HTML / JavaScript:
& lt; Div class = "backtotop" & gt; & Lt; A href = "#" & gt; Back to top & lt; / A & gt; & Lt; / Div & gt; & Lt; Script type = "text / javascript" & gt; $ (Document) .scroll (function () {var y = $ (this) .scrollTop (); if (y & gt; 1) {$ ('. Backcop'). FadeIn ();} else {$ (' Bakopoth '). FadeOut ();}}); & Lt; / Script & gt;
CSS:
.backtotop {display: none; Width: 200px; Height: heir; Status: fixed; Bottom: 0; Correct: 0; Border: Thin solid black; Background: lightgray; Art color; Z-index: 1; Text-align: center; } .backtotop one {color: black; Font-family: Calibri; }
Actually, my question is: Why does my code work?
Thanks a lot!
Are you using jQuery's installed link anywhere before this code? And if yes, check your Javascript console and see if there are errors.
install jQuery link:
& lt; Script src = "http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
Comments
Post a Comment