Last active
August 22, 2018 12:08
-
-
Save Robin-bob/1f965c08af4109ac5680f337380ecbd4 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
$(function(){ | |
$('.js-use-cases-pages--slider').slick({ | |
dots: true, | |
fade: true, | |
cssEase: 'linear', | |
autoplay: true, | |
autoplaySpeed: 5000, | |
pauseOnHover: false | |
}) | |
// instanciate new modal | |
if ($('.use-case-modal').length) { | |
var modal = new tingle.modal({ | |
footer: false, | |
stickyFooter: false, | |
ccloseMethods: ['overlay', 'button', 'escape'], | |
closeLabel: "Close", | |
cssClass: ['use-case-modal-wrapper'], | |
onOpen: function() { | |
}, | |
onClose: function() { | |
$('.js-modal-company-name').text(''); | |
$('.use-case-modal-wrapper--iframe').attr('src', '') | |
}, | |
beforeClose: function() { | |
// here's goes some logic | |
// e.g. save content before closing the modal | |
return true; // close the modal | |
return false; // nothing happens | |
} | |
}); | |
// set content | |
modal.setContent($('.use-case-modal').html()); | |
$('.use-case-modal').html('') | |
// open modal | |
$('.use-case-block').on('click', function(e){ | |
e.preventDefault(); | |
var companyName = $(this).find('.use-case-block--footer-name').text() | |
var companyLink = $(this).attr('href') | |
$('.js-modal-company-name').text(companyName) | |
$('.use-case-modal-wrapper--iframe').attr('src', companyLink) | |
modal.open(); | |
return false; | |
}); | |
$('.use-case-modal-close').on('click', function(e){ | |
e.preventDefault(); | |
modal.close(); | |
return false; | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment