jquery - Toggle multiple divs using images -
i vytautas butkus' solution question (second answer down @ jquery hide , show toggle div plus , minus icon , demo here):
$(".toggle").on("click", function(e){ $(this).toggleclass("expanded"); $content.slidetoggle(); });
but if there multiple divs per page, code toggles them @ same time. other solutions near i'm looking for, code uses images, changes images on toggle, , doesn't use anchor tags. how can code modified function same open div that's being clicked? in advance.
you can use next()
if div class toggle , div class content next each other respectively...
$(document).ready(function () { var $content = $(".content").hide(); $(".toggle").on("click", function (e) { $(this).toggleclass("expanded"); $(this).next().slidetoggle(); }); });
Comments
Post a Comment