jquery - How to show div as popup on click of anchor tag? -
i want show div
popup on-click of anchor tag image. have 1 main image , 4 vertical thumbnails side of image.
on main image, top corner 1 anchor tag image there. upon clicking on image, want whole main image , thumbnails show in popup.
if i'm not wrong, jquery core doesn't have method show modal\pop up.
you can achieve request in vanilla javascript in way:
<a id="picture1" data-id="1" href="#" onclick="showdialog(this);"> <!-- img or whatever --> </a> <dialog id="picturedialog"> <!-- dialog content --> </dialog> <script> function showdialog(element) { var id = e.getattribute("data-id"); //do setup dialog document.getelementbyid("picturedialog").showmodal(); } </script>
remaining in jquery family, can open modal using jquery ui: http://api.jqueryui.com/dialog
or adding framework of flavor, bootstrap: http://getbootstrap.com/javascript/#modals
Comments
Post a Comment