jquery - SlideToggle not working correctly after using .load (ajax) -
i experimenting custom lightbox effect , finding quite complicated. experience getting more refined have found once load modal window (contact) , remove instances of slidetoggle no longer work correctly.
this code: (not sure helps)
$('.viewinfo').on( 'click', function(e){ e.preventdefault(); $(this).parent('.project').find('.project-info').slidetoggle(1500, 'easeoutcubic'); $(this).toggleclass('closeinfo'); }); $('#icon-mobile-menu').on('click', function(){ $('#mobile-nav ul').slidetoggle(1500); });
i still new jquery there don't understand... appreciated
try changing instead (delegated click event perhaps):
get rid of easing effect , see if causes problem go away now:
$('body').on( 'click', '.viewinfo', function(e){ e.preventdefault(); $(this).parent('.project').find('.project-info').slidetoggle(1500); $(this).toggleclass('closeinfo'); }); $('body').on('click', '#icon-mobile-menu', function(){ $('#mobile-nav ul').slidetoggle(1500); });
technically, should use immediate parent constant element , not body
, body
work also.
hope i'm understanding correctly. let me know if helps any...
Comments
Post a Comment