Filter Through Elements With Same Class But Not In The Same Wrapper
Using the method I found here I'm trying to upgrade the functionality of my previous question. Basically I want to cycle through my elements with previous and next buttons. I canno
Solution 1:
Change this:
var$prev_item = $content.find('.current').findPrev('.item');
if ($content.find('.item').hasClass('current')) {
if ($prev_item.length) {
$content.find('.item').removeClass('current');
}
load_gallery_container_next_prev($prev_item);
}
to this:
var $prev_item = $(".item")[$(".item").index($(".item.current"))-1];
if($prev_item){
$(".item.current").removeClass('current');
}
$($prev_item).addClass('current');
load_gallery_container_next_prev($prev_item);
and change this:
functionload_gallery_container_next_prev($container) {
$loaded_content.find('.div_content').html($container.data('content'));
$container.addClass('current');
}
to this:
functionload_gallery_container_next_prev($container) {
$loaded_content.find('.div_content').html($($container).attr("data-content"));
$container.addClass('current');
}
Post a Comment for "Filter Through Elements With Same Class But Not In The Same Wrapper"