My code is for wordpress in noconflict mode
This code works only on double click not on a single click,any advice or guideness is welcomed.
I want to make it work on a single click.
Thank you in advance

$j=jQuery.noConflict();

 $j(document).ready(function() {

  $j("#icomenu").toggle(function(){
                $j("#menu").animate({left:"0px"});

            },
            function(){
                $j("#menu").animate({left:"-280px"});   

        }) 
    }) ;    

What will tha output of this coading!!!!

First click triggers animate left 0px... that does nothing. See the example in the documentation.

That's kinda weird. Uhmm can you do this instead, without clearing the '$' variable in global.

(function($){
    $(document).ready(function() {
        $("#icomenu").toggle(
            function(){
                    $("#menu").animate({left:"0px"});
                },
            function(){
                    $("#menu").animate({left:"-280px"});   
                }) 
        });  
})(jQuery);

Are you using different jQuery versions?

Ok first of all the code works but just on double click in wordpress but without wordpress this code works great,the second thing is that this is the way wordpress accepts to see the code ,furthermore wordpress adds the last version of jquery automaticly

wordpress jquery way

Thabk your for your help
But I think I will use addClass function and removeClass

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.