Skip to content

Instantly share code, notes, and snippets.

@Avanger2512
Created July 18, 2016 14:42
Show Gist options
  • Save Avanger2512/4eb301ee26e21200ff020a9b75432efc to your computer and use it in GitHub Desktop.
Save Avanger2512/4eb301ee26e21200ff020a9b75432efc to your computer and use it in GitHub Desktop.

Revisions

  1. Avanger2512 renamed this gist Jul 18, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. Avanger2512 created this gist Jul 18, 2016.
    42 changes: 42 additions & 0 deletions with slick
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    //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
    });
    }