Skip to content

Instantly share code, notes, and snippets.

@FabianSchmick
Last active February 21, 2018 10:28
Show Gist options
  • Save FabianSchmick/0a22742ba3730b7715141aafac54efc2 to your computer and use it in GitHub Desktop.
Save FabianSchmick/0a22742ba3730b7715141aafac54efc2 to your computer and use it in GitHub Desktop.
Thumbnail pictures for Owl-Carousel
$(document).ready(function() {
$("#slider").owlCarousel({
navigation : true, // Show next and prev buttons
slideSpeed : 300,
paginationSpeed : 400,
singleItem:true,
navigationText: false,
pagination : true
});
var dotcount = 1;
jQuery('.owl-dot').each(function() {
jQuery(this).addClass('dotnumber' + dotcount);
jQuery(this).attr('data-info', dotcount);
dotcount = dotcount +1;
});
var slidecount = 1;
jQuery('.owl-item').not('.cloned').each(function() {
jQuery(this).addClass('slidenumber' + slidecount);
slidecount = slidecount +1;
});
jQuery('.owl-dot').each(function() {
var grab = jQuery(this).data('info');
var slidegrab = jQuery('.slidenumber' + grab + ' img').attr('src');
jQuery(this).css("background-image", "url(" + slidegrab + ")");
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment