Skip to content

Instantly share code, notes, and snippets.

@ChristopherDosin
Created September 15, 2016 15:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChristopherDosin/99967ba61d477819ab8aa0cefe126783 to your computer and use it in GitHub Desktop.
Save ChristopherDosin/99967ba61d477819ab8aa0cefe126783 to your computer and use it in GitHub Desktop.
Shopware Altersabfrage Modal
// 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