Users Pricing

forum

home / developersection / forums / jquery toggle if statement

Jquery Toggle If statement

Anonymous User 2681 23 Nov 2014

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.


I am a content writter !


1 Answers