javascript - Binded code executes only on one page, after redirect it stops working. Mobile jQuery -


heres scenario.

i'm using mobile jquery. meaning html gets updated using ajax.

i have navigation menu on top.

i have 2 pages (id= "#p1" , id="#p10"). both pages contain same nav menu.

when user clicks on icon on menu should slide 1 of divs screen. when user click "x" or outside of new div should closed.

i'm handling using next js code.

$(document).bind('pageinit', function() {     alert('test');  $(document).on('click' , '.menu_open' , function() {      $('.mask').addclass('mask_visible');   $('#menu').animate({     marginleft: "0%",     opacity: 1     }, 200);     $('#menu').css('display', 'block');   });     $(document).on('click','.menu_close , .mask ', function() {     $('.mask').removeclass('mask_visible');   $('#menu').animate({     marginleft: "-100%",     opacity: 0     }, 200);   });    $(document).on("swipeleft", '#menu', function(){   $('.mask').removeclass('mask_visible');     $('#menu').animate({     marginleft: "-100%",     opacity: 0     }, 200);   });  }); 

how looks.

currently code placed in after scripts.

the problem code works on first page load. after redirect second page "alert" code trigger won't able pull out nav bar anymore.


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -