CSS-Tricks / AnythingSlider

A jQuery Slider plugin for anything.
http://css-tricks.github.io/AnythingSlider/
GNU Lesser General Public License v3.0
1.15k stars 380 forks source link

Problem with updating 'cur' class #573

Closed JKnightWebDesign closed 11 years ago

JKnightWebDesign commented 11 years ago

Hi guys, I can't seem to figure out what might be the problem with my custom external nav controls. If I have it setup to just be an external nav I have no problems. As soon as I try to setup an 'active' class using the example provided with a 'cur' class it locks up and the slider no longer works. Any idea what I might be doing wrong?

I'm using:

Ignore the text, it's hidden using text indent and the id's are for placement. The Jquery I'm using is:

var nav = $('.gallery-nav a'), updateNav = function(page){ nav .removeClass('cur') .eq(page).addClass('cur'); }

$('#slider').anythingSlider({ // If true, builds a list of anchor links to link to each panel buildNavigation: false, onInitialized: function(e, slider) { updateNav(slider.currentPage-1); }, // Callback before slide animates onSlideBegin: function(e, slider) { updateNav(slider.targetPage-1); } });

// set up external links nav.click(function(){ var slide = $(this).attr('href').substring(1); $('#slider').anythingSlider(slide); return false; });

Thanks in advance! :)

JKnightWebDesign commented 11 years ago

Don't worry, got it fixed. Stupid mistake on my part. I missed the opening function tag: // DOM Ready $(function(){

:smile: OOPS!