Created
August 24, 2016 16:22
-
-
Save nicothin/ae77c3e3e456c2ed5f54b0337367633c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
// Галерея на главной | |
var gallery = $('#gallery'); | |
gallery.owlCarousel({ | |
items: 4, // одновременно 4 миниатюры | |
loop: true, // включаем петлю | |
center: true, // центрируем активную миниатюру | |
mouseDrag: false, // отключаем перетаскивание мышом | |
}); | |
// Следим за изменением в галерее (смена активного слайда) | |
gallery.on('changed.owl.carousel',function(property){ | |
var current = property.item.index; | |
var src = gallery.find(".owl-item").eq(current).find("img").data('large-img-url'); | |
$('#gallery-large-img').attr('src', src ); | |
}); | |
// Следим за кликами на мириатюрах галереи | |
$('#gallery img[data-large-img-url]').on('mousedown', function(){ | |
$('#gallery-large-img').attr('src', $(this).data('large-img-url') ); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment