2011-01-11 12 views
1

これには他の投稿がありますが、私の設定はやや異なり、私は最後のステップを決めることができません。Jcarousel Active class

function mycarousel_initCallback(carousel) { 
jQuery('.jcarousel-control a').bind('click', function() { 
    carousel.scroll(jQuery.jcarousel.intval(jQuery(this).attr("id"))); 
    return false; 
}); 

jQuery('#mycarousel-next').bind('click', function() { 
    carousel.next(); 
    carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value); 
    return false; 
}); 

jQuery('#mycarousel-prev').bind('click', function() { 
    carousel.prev(); 
    carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value); 
    return false; 
}); 

jQuery('#offerings li a').bind('click', function() { 
    var index = $(this).attr("id").split("_"); 
    carousel.scroll(jQuery.jcarousel.intval(index[1])); 
    //carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text())); 
    $("#offerings li a").removeClass("active"); //Remove any "active" class 
    $(this).addClass("active"); 
    return false; 
}); 
}; 

これは、あなたが外部制御(#offerings)内のリンクをクリックしたときにアクティブなクラスを追加するための素晴らしい作品が、あなたは前を使用する場合と:これは私のJcarouselスライダーのためのjQueryある

次のボタンを押すと、メニューアクティブクラスは更新されません。

すべてのヘルプ感謝:)

答えて

1

問題は、問題は、あなたがスクロールするには、2つの機能を持っている、ここで

carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value); 
+1

コメントアウトされた行はコメントアウトしないでください。それは問題を引き起こし、コメントアウトされている行ですか?よくわかりません。 – dlamblin

0

です。たとえば :のみ次のと同じ前の関数に 使用中のnext()機能:

.next() 

をして、あなたは別のスクロール機能

.scroll 

ソリューションによって、それに続きました。