Hey Warriors, I am new to Javascript and want to implement something which I think should be somewhat simple on my website. I have a link to my webpage below which I am testing on.
Simple JavaScript Assistance needed.
3
Hey Warriors,
I am new to Javascript and want to implement something which I think should be somewhat simple on my website. I have a link to my webpage below which I am testing on.
I am attempting to have a div appear afte the user starts scrolling.
Link to test page: Test 1 |
For my html I have:
In my header file I have:
In my .js file I have:
I am getting this error on the page: Uncaught ReferenceError: $ is not defined
So I am not 100% sure why the error is there, and I am not 100% sure that my javascript is correct. It is a wordpress site if that matters.
Please please help me out. Thank you so much for your time, and sorry if this is a novice mistake.
I am new to Javascript and want to implement something which I think should be somewhat simple on my website. I have a link to my webpage below which I am testing on.
I am attempting to have a div appear afte the user starts scrolling.
Link to test page: Test 1 |
For my html I have:
Code:
<div id="mydiv">test div</div>
Code:
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/test1.js">
</script> In my .js file I have:
Code:
$(window).scroll(function() {
if ($(this).scrollTop() == 0) {
$("#mydiv:visible").hide();
}
else {
$("#mydiv:hidden").show();
}
}); So I am not 100% sure why the error is there, and I am not 100% sure that my javascript is correct. It is a wordpress site if that matters.
Please please help me out. Thank you so much for your time, and sorry if this is a novice mistake.
- mikeonrails
- [ 1 ] Thanks
- [1] reply
- jleavitt13
Next Topics on Trending Feed
-
3