Skip to content

Commit 4d121ad

Browse files
committed
always install the onsubmit hook, even if the form is hidden by timeout
1 parent 4a66e6e commit 4d121ad

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

templates/footer.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,11 @@ class="<?php
2929
<script type="text/javascript">
3030
jQuery(function( $ ) {
3131
var overlay = $( '#eu-cookie-law' ), initialScrollPosition, scrollFunction;
32-
if ( overlay.hasClass( 'hide-on-button' ) ) {
33-
overlay.find( 'input.accept' ).on( 'click', accept );
34-
} else if ( overlay.hasClass( 'hide-on-scroll' ) ) {
32+
overlay.find( 'form' ).on( 'submit', accept );
33+
if ( overlay.hasClass( 'hide-on-scroll' ) ) {
3534
initialScrollPosition = $( window ).scrollTop();
3635
scrollFunction = function() {
3736
if ( Math.abs( $( window ).scrollTop() - initialScrollPosition ) > 50 ) {
38-
console.log($( window ).scrollTop() - initialScrollPosition);
3937
accept();
4038
}
4139
};
@@ -60,7 +58,7 @@ function accept( event ) {
6058
}
6159

6260
var expireTime = new Date();
63-
expireTime.setTime( expireTime.getTime() + <?php echo $cookie_validity; ?> ); // 30 days
61+
expireTime.setTime( expireTime.getTime() + <?php echo $cookie_validity; ?> );
6462

6563
document.cookie = '<?php echo $cookie_name; ?>=' + expireTime.getTime() + ';path=/;expires=' + expireTime.toGMTString();
6664

0 commit comments

Comments
 (0)