Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Calling a javascript function with onClick

    I have the following script that calls a panel to open and close. It works very well ... but I want it to close upon a selected item.

    Code:
    var sipPos = 0;
    $(document).ready(function() {
    	$("#panel-tab").click(function(e) {
    		e.preventDefault();
    		$("#panel").animate({ left: sipPos }, 600, 'linear', function() {
    			if(sipPos == 0) { sipPos = -200; }
    			else { sipPos = 0; }
    		});
    	});
    });
    So what I'm loking for is the proper syntax to call the function to check if the panel is open and close it.

    something like onClick="panel-tab()," But I must be calling the wrong thing because that doesn't seem to work. Obviously, I'm very new at this ... so apologize in advance for missing the obvious. Any help would be appreciated.

  • #2
    Regular Coder
    Join Date
    Jan 2008
    Location
    Geneva, Switzerland
    Posts
    413
    Thanks
    12
    Thanked 29 Times in 29 Posts
    A link to your code would be good to have. Or at least post the HTML that goes with it, please.
    Chuck Norris counted to infinity.
    Twice.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •