Created
July 18, 2016 14:42
-
-
Save Avanger2512/4eb301ee26e21200ff020a9b75432efc to your computer and use it in GitHub Desktop.
popups with galllery
This file contains hidden or 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
| //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