I am attempting to change a href url once the browser scroll down. I am swapping css classes based on browser position. I am swappping out an image with an anchor down tag applied to it with a logo that I now what to have a home link applied to it.
Check my site here: http://www.paynecocraft.com (WIP)
The main page has a yellow arrow at the bottom. Click it and the browser scrolls, the nav becomes sticky and the logo appears. I would like the logo to have a homepage link once it gets to that point.
Here is my html
<nav>
<ul class="inline-list main-links">
<li class="linkitem"><a href="#">About</a></li>
<li class="linkitem"><a href="#">Work</a></li>
<li class="linkitem"><a href="http://www.paynecocraft.com/store">Store</a> </li>
<li class="circlearrow"><a id="changeonscroll" href="#scrolldown"></a></li>
<li class="linkitem"><a href="#">Plans</a></li>
<li class="linkitem"><a href="#">Contact</a></li>
<li class="linkitem"><a href="#">Blog</a></li>
</ul>
</nav>
I'm referring to the "circlearrow" li.
Here is the javascript I am using, but its not working. I'm just now diving into Javascript so I probably don't have something right. Forgive me.
<script>
$(document).ready(function(){
$(window).bind('scroll', function() {
var navHeight = $( window ).height() - 80;
if ($(window).scrollTop() > navHeight) {
document.getElementById("changeonscroll").href = http://www.paynecocraft.com;
}
});
});
</script>
http://www.paynecocraft.comshould be in string form sodocument.getElementById("changeonscroll").href = "http://www.paynecocraft.com";