January 3, 200917 yr Hi all, On a HTML page I have placed 12 flash animations within a span tag and have given each of those span tags the class flash. I have an anchor tag that with the class showall to show the flash animations and another anchor tag with the class hideall to hide them What I want to end up doing in the end is having showall# open flash# and hideall# closing its corresponding flash#. Below is my current jQuery code running for the example from paragraph 1. Now how would I go about writing my new jQuery code without creating a 12 different sets of code merely with a change of character in the class names etc. Is there a smart way to do this using parameters or something? Sorry, my JavaScript knowledge isn't that strong <!-- this is in the <head> by the way --> <script> $(document).ready(function(){ $("span.flash").hide(); $("a.showall").click(function(){$("span.flash").slideDown(800)}); $("a.hideall").click(function(){$("span.flash").fadeOut(800)}); }); </script>
Create an account or sign in to comment