Add onclick event to shortcode
-
Would it be possible to trigger a javascript event in a shortcode? Something like
[ngg src=”galleries” ids=”4″ display=”basic_tagcloud” onclick=”HideGallery()”]The idea is to have a page initially showing two galleries, one with a tag cloud, and one with the latest images. Upon clicking a tag, the gallery with the latest images is supposed to disappear. The entire code would be like this:
[ngg src="galleries" ids="4" display="basic_tagcloud" onclick="HideGallery()"] <div id="LatestGallery"> <h3>Latest images</3> [ngg src="galleries" ids="4" display="basic_thumbnail" images_per_page="24"] </div> <script> function HideGallery() { var x = document.getElementById("LatestGallery"); if (x.style.display === "none") { x.style.display = "block"; } else { x.style.display = "none"; } } </script>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Add onclick event to shortcode’ is closed to new replies.