I'm trying to run a function when the state of the toggle is
only "open". Right now the function runs either way. I'm not entirely
sure how to make it so that it only runs when the toggle is opened. I found the
toggle code somewhere and used it, it works great.
$( "#SB2p" ).click(function() {
$( "#SB2").toggle('slow',function(){
var $link =$("#SB2p");
$(this).is(":visible") ? $link.text("<<<") : $link.text(">>>");
});
accumulative();
});
Any help would be great.
Anonymous User
24-Nov-2014You already have a working example. The ternary operator uses $(this).is(':visible'), so use that: