javascript - Click go to modal section -
this want achieve:
the modal has 4 sections, each section loads it´s content dinamically using .load() container on right.
the problem have menu in footer opens modal, , should put user in correct section:
i don´t know how make it, example if click on footer menu 'metodos de pago' it open modal in specified section. ideas on how it?
this script load modal:
function loadmodal(){ $('.info_modal').fadein(); }
this script load content of sections in modal after clicking on left menu:
function loadcontent(){ $('.info_modal_content').load('includes/text2.html'); }
markup of modal:
<div class="info_modal"> <div class="info_modal_container"> <h2>guia de compra</h2> <hr> <ul class="info_modal_menu"> <li> <a href="javascript:void(0)">como comprar</a> </li> <li> <a href="javascript:void(0)" onclick="loadcontent()">metodos de pago</a> </li> <li> <a href="javascript:void(0)">cambios y devoluciones</a> </li> <li> <a href="javascript:void(0)">tarjeta regalo</a> </li> </ul> <div class="info_modal_content"> <h2>targeta puedes comprarla en...</h2> <p>tu tarjeta puede ser rechazada por una de las</p> </div> <a href="javascript:void(0)" class="close_contact" onclick="closecontactmodal()"></a> </div> </div>
why not pass through url initial load?
assuming footer structured like:
<footer> <ul> <li><a href="text1.html" class="openmodal">text 1</a></li> <li><a href="text2.html" class="openmodal">text 2</a></li> <li><a href="text3.html" class="openmodal">text 3</a></li> <li><a href="text4.html" class="openmodal">text 4</a></li> </ul> </footer>
and attach handler .openmodal
:
$('.openmodal').on('click', function(e){ e.preventdefault(); var toload = $(this).attr('href'); $('.info_modal_content').load(toload); $('.info_modal').fadein(); });
Comments
Post a Comment