Close, open new magnific popup window via API -
via function, trying close open magnific popup window , open new one.
what have image gallery custom title includes links. link closes magnific gallery of images , open ajax window. script uses lightbox show images , have "add cart" link opens form (to select various options) via ajax add current image cart.
function sunshine_add_to_cart(image) { var image_url = jquery(image).attr('href'); jquery.magnificpopup.close(); jquery.magnificpopup.open({ items: { src: image_url+'?sunshine_lightbox_cart=1' }, type: 'ajax' }, 0); console.log(image_url); }
the magnific gallery closes, ajax never does. console logging proper url value exist. same url opened via standard link works fine.
http://screencast.com/t/yodiy2j76t - standard link opens - http://screencast.com/t/ee18cl19tusi - add cart ajax window fine
http://screencast.com/t/whgseoyijn6g - link in image view closes current gallery not open new ajax window. when cart icon clicked, runs "sunshine_add_to_cart" function via:
<a href="http://sunshinepro.dev/client-galleries/gallery/digital-downloads/223ad622-low-23192542-2/" onclick="sunshine_add_to_cart(this); return false;" data-image-id="2401"><i class="fa fa-shopping-cart"></i></a>
i had similar issue. problem me event bubbling. had link , funktion triggered onclick. added return false , worked. hth
Comments
Post a Comment