-4
Good morning.
I linked the javascript on my site as follows:
script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js">
and one of the codes is this, inserted just after the body, to fix menu after scrolling:
<script type="text/javascript">
jQuery("document").ready(function($){
var nav = $('.menu');
$(window).scroll(function () {
if ($(this).scrollTop() > 10) {
nav.addClass("fixar");
} else {
nav.removeClass("fixar");
}
});
</script>
But nothing works, I’ve tried the "hello world" to test the js but neither does it work. Anyone has any idea what might be working?
missing you close tags.. at the end of everything do not close the initial function.. adds another "});"
– sir_ask
Please enter the full Code of your page.
– hugocsl
"inserted just after the body" - And why don’t you put it within of
<body>
? Or better yet, inside the<head>
?– Victor Stafusa
sir_ask really was it. Thank you very much :)
– Leonardo Henrique
This feels really wrong
jQuery("document").ready(function($){
, you should probably usejQuery(document).ready
orjQuery.ready
– Guilherme Nascimento