Created
September 15, 2016 15:28
-
-
Save ChristopherDosin/99967ba61d477819ab8aa0cefe126783 to your computer and use it in GitHub Desktop.
Shopware Altersabfrage Modal
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
// check if cookie exist | |
if(!Cookies.get('of_age1')) { | |
// if not open the modal | |
$.modal.open('<div style="padding:20px">'+ | |
'<p>Bist du schon über 18 Jahre alt?</p>'+ | |
'<button class="btn">Ja ich bin über 18</button>'+ | |
'</div>',{ | |
title: 'Bist du schon 18?', | |
additionalClass: 'of_age', | |
width: 300, | |
height: 300, | |
closeOnOverlay: false, | |
showCloseButton: false, | |
}); | |
} | |
// trigger the function if button is clicked | |
$('.of_age button').on('click', function() { | |
// Set the cookie | |
Cookies.set('of_age1', true); | |
// and close the modal | |
$.modal.close(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment