I am running a Jcarousel and I want to add a.active to the current pagination option. I have seen other posts around about this same thing.
/**
* We use the initCallback callback
* to assign functionality to the
controls
*/
function mycarousel_initCallback(carousel) {
jQuery('.jcarousel-control a').bind('click', function() {
carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
return false;
});
jQuery('#mycarousel-next').bind('click', function() {
carousel.next();
return false;
});
jQuery('#mycarousel-prev').bind('click', function() {
carousel.prev();
return false;
});
};
// Ride the carousel...
jQuery(document).ready(function() {
jQuery("#mycarousel").jcarousel({
scroll: 1,
initCallback: mycarousel_initCallback,
// This tells jCarousel NOT to autobuild prev/next buttons
buttonNextHTML: null,
buttonPrevHTML: null
});
});
</script>
Thats the initialize code
and the pagination lives inside:
<ul class="jcarousel-control">
<% (
[email protected]).each do |n| %>
<li><a href="#"> <%= n %></a></li>
<% end %>
</ul>
Its a rails app, so rails is creating the list based on the number of projects in the group.
Any ideas? Seems like it should be pretty simple.. But I don't know js at all.