jQuery popup overlay - get content -
i'm using jquery popup overlay - http://www.jqueryscript.net/demo/responsive-accessible-jquery-modal-plugin-popup-overlay/
instead of embedding popup content in html , wanting page on click. have working content on click , issue have using 4 popup tablinks , , if click 1 , getting duplicate results. tried use .one click , slice neither worked.
here html , script
<li class="tablink rafters_btn_open"><a>rafter popup tab</a></li> <li class="tablink postseason_btn_open"><a>postseason popup tab</a></li> <li class="tablink alpha_btn_open"><a>alpha popup tab</a></li> <li class="tablink hof_btn_open"><a>hof popup tab</a></li> $('.tablink').one('click',function(){ $.get('http://mysite.page2.com', function (data) { $(data).find('#rafters').appendto('#rafters_btn'); $(data).find('#hof').appendto('#hof_btn'); $(data).find('#alphacup').appendto('#alpha_btn'); $(data).find('#postseason').appendto('#postseason_btn'); }); }); <div id="rafters_btn"></div> <div id="hof_btn"></div> <div id="alpha_btn"></div> <div id="postseason_btn"></div>
if click on tablink.rafters_btn_open , click on of others , reclick tablink.rafters_btn_open begin 2,3,4 copies of content. advice ?
try add class clicked element
$('.tablink').on('click',function(){ var thisit = $(this); if(!thisit.hasclass('clicked')){ $.get('http://mysite.page2.com', function (data) { $(data).find('#rafters').appendto('#rafters_btn'); $(data).find('#hof').appendto('#hof_btn'); $(data).find('#alphacup').appendto('#alpha_btn'); $(data).find('#postseason').appendto('#postseason_btn'); $('.tablink').removeclass('clicked'); $(this).addclass('clicked'); }); } });
Comments
Post a Comment