I have an image slideshow with navigation, with which I want to add an animated element to highlight the active slide, using an arrow graphic which moves to the active slide as the slideshow rotates. I'm using the jQuery Cycle plugin, which adds the 'activeSlide' class to the relevant slide number and I'm trying to get the finished result to be something like the slider on http://offerpop.com/, where the arrow moves the active slide automatically, as well as on click.
I've been trying to follow what seems to be the same objective from this thread: If $(element) hasClass then .animate() not working? but so far I haven't got it to function as I'd like to, based on the suggestions of this thread.
So I would be grateful if anyone can help me out and point me in the right direction to which method would be the way to go, as I don't really know where to start. Thanks
Here's the navigation part of the code:
<div id="nav">
<div id="navitem" class="activeSlide"><a>1</a></div>
<div id="navitem"><a>2</a></div>
<div id="navitem"><a>3</a></div>
<div id="navitem"><a>4</a></div>
<div id="navitem"><a>5</a></div>
</div>
<div id="nav"></div>
<div id="arrow"></div>
<script type="text/javascript">
$(document).ready(function() {
if($('#navitem').hasClass("activeSlide")){
$("#arrow").animate({marginLeft:"100px"}, 500);
};
});
</script>