Skip to content

Instantly share code, notes, and snippets.

@Avanger2512
Created July 18, 2016 14:42
Show Gist options
  • Select an option

  • Save Avanger2512/4eb301ee26e21200ff020a9b75432efc to your computer and use it in GitHub Desktop.

Select an option

Save Avanger2512/4eb301ee26e21200ff020a9b75432efc to your computer and use it in GitHub Desktop.
popups with galllery
//popup
$('.js-popup__close').on('click', function(){
$('.popup').hide()
$('.js-popup').slick('unslick')
})
$('.js-gallery__item').on('click', function(){
var el = $(this);
$('.popup').show();
getContent(el);
})
function getContent(el) {
if (el.data('gallery') == 1){
var $content = $('.js-world-luxary_first').find('.js-gallery__item').clone();
showContentInPopup($content, el.data('num'));
} else if (el.data('gallery') == 2){
var $content = $('.js-world-luxary_second').find('.js-gallery__item').clone();
showContentInPopup($content, el.data('num'));
console.log($content);
}
}
function showContentInPopup($content, num){
$('.js-popup').html($content);
$('.js-popup').find('div').removeAttr('class');
$('.js-popup').find('div').addClass('popup__item');
$('.js-popup').slick({
infinite: false,
slidesToShow: 1,
slidesToScroll: 1,
nextArrow: $('.popup__next'),
prevArrow: $('.popup__prev'),
arrows: true,
initialSlide: num
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment