round
09-20-2016, 02:04 PM
Hello Everyone,
Can anyone please tell how can we skip display:none items in owl carousel?
My html is like this :-
<div id="owl-demo">
<div class="item" id="image1"><img src="images/1.jpg" alt="Owl Image"></div>
<div class="item" id="image2"><img src="images/2.jpg" alt="Owl Image"></div>
<div class="item" id="image3"><img src="images/3.jpg" alt="Owl Image"></div>
<div class="item" id="image4" style="display:none;"><img src="images/4.jpg" alt="Owl Image"></div>
<div class="item" id="image5"><img src="images/5.jpg" alt="Owl Image"></div>
<div class="item" id="image6"><img src="images/6.jpg" alt="Owl Image"></div>
<div class="item" id="image7"><img src="images/7.jpg" alt="Owl Image"></div>
<div class="item" id="image8"><img src="images/8.jpg" alt="Owl Image"></div>
</div>
Here is my jquery :-
<script>
jQuery(document).ready(function() {
jQuery("#owl-demo").owlCarousel({
autoPlay: 3000, //Set AutoPlay to 3 seconds
navigation : true,
items : 4,
itemsDesktop : [1199,3],
itemsDesktopSmall : [979,3]
});
//jQuery("#owl-demo").data('owlCarousel').visibleItems;
});
</script>
Now the issue is I do not want to display the "display:none" items. Display none items are not coming but at the end there comes a empty space, that should not come. Please check the attachment with the demo.
Please note that I do not want to remove items like this :-
$("#owl-demo").data('owlCarousel').removeItem(3);
What I want is the items with display:none or class 'hidden' should not be included in the slider at the time of page load. (This is the primary thing I need)
Another thing I want is after page is loaded - there will be a button on page. When we click that button - certain lis will become hidden (display:none or class - hidden) & certain will become visible (class hidden will be removed or display:none will be removed) in that case also slider should be refreshed & show only visible items.
Will that be possible with owl carousel? or I need to change the slider? If I need to change then which slider will be helpful?
Please check the attached demo. (Please add any 8 images & name it 1.jpg, 2.jpg like that, because of upload file size issue I removed those images)
Any one can help please?
Thanks.
Can anyone please tell how can we skip display:none items in owl carousel?
My html is like this :-
<div id="owl-demo">
<div class="item" id="image1"><img src="images/1.jpg" alt="Owl Image"></div>
<div class="item" id="image2"><img src="images/2.jpg" alt="Owl Image"></div>
<div class="item" id="image3"><img src="images/3.jpg" alt="Owl Image"></div>
<div class="item" id="image4" style="display:none;"><img src="images/4.jpg" alt="Owl Image"></div>
<div class="item" id="image5"><img src="images/5.jpg" alt="Owl Image"></div>
<div class="item" id="image6"><img src="images/6.jpg" alt="Owl Image"></div>
<div class="item" id="image7"><img src="images/7.jpg" alt="Owl Image"></div>
<div class="item" id="image8"><img src="images/8.jpg" alt="Owl Image"></div>
</div>
Here is my jquery :-
<script>
jQuery(document).ready(function() {
jQuery("#owl-demo").owlCarousel({
autoPlay: 3000, //Set AutoPlay to 3 seconds
navigation : true,
items : 4,
itemsDesktop : [1199,3],
itemsDesktopSmall : [979,3]
});
//jQuery("#owl-demo").data('owlCarousel').visibleItems;
});
</script>
Now the issue is I do not want to display the "display:none" items. Display none items are not coming but at the end there comes a empty space, that should not come. Please check the attachment with the demo.
Please note that I do not want to remove items like this :-
$("#owl-demo").data('owlCarousel').removeItem(3);
What I want is the items with display:none or class 'hidden' should not be included in the slider at the time of page load. (This is the primary thing I need)
Another thing I want is after page is loaded - there will be a button on page. When we click that button - certain lis will become hidden (display:none or class - hidden) & certain will become visible (class hidden will be removed or display:none will be removed) in that case also slider should be refreshed & show only visible items.
Will that be possible with owl carousel? or I need to change the slider? If I need to change then which slider will be helpful?
Please check the attached demo. (Please add any 8 images & name it 1.jpg, 2.jpg like that, because of upload file size issue I removed those images)
Any one can help please?
Thanks.