Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- var popup = $('.films__popup');
- var center = popup.find('.films__popup__container');
- var close = popup.find('.films__popup__close');
- $('.films__list__item__image__link').on('click', function() {
- var src = $(this).closest('.films__list__item').data('src') + '?autoplay=1';
- var bottom = $(this).find('.films__list__item__bottom').html();
- popup.find('iframe').attr('src', src);
- popup.find('.films__popup__bottom').html(bottom);
- popup.fadeIn();
- $('body').addClass('no_scroll');
- });
- close.on('click', function() {
- closePopup();
- $('body').removeClass('no_scroll');
- });
- $(document).mouseup(function(e) {
- if (!center.is(e.target) && center.has(e.target).length === 0) {
- closePopup();
- }
- });
- function closePopup() {
- popup.fadeOut();
- popup.find('iframe').attr('src', '');
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement