rx3mer Posted July 27, 2013 Share Posted July 27, 2013 Hey guys, I was just woundering what would be the best way of writing multiple popup functions? I can copy the code few times and change the ID but that doesen't sound efficeint. <script type="text/javascript"> var popUpActive = false; $(document).ready(function(){ //open popup $("#pop").click(function(){ if(popUpActive == false){ $("#flyout").fadeIn(150, function(){ popUpActive = true; }); } }); $(document).click(function(){ if(popUpActive == true) $("#flyout").fadeOut(150, function(){ popUpActive = false; }); }); }); </script> Link to comment https://forums.phpfreaks.com/topic/280565-jquery-multiple-populs/ Share on other sites More sharing options...
trq Posted July 27, 2013 Share Posted July 27, 2013 So attach it to a class instead of an id. ps: I moved your thread as it has nothing at all to do with Ajax. Link to comment https://forums.phpfreaks.com/topic/280565-jquery-multiple-populs/#findComment-1442378 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.