Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

move element onclick javascript

$(function()
{
  var expanded = false;
  $('#sidebar').click(function()
                      {
                          if (!expanded)
                          {
                              $(this).animate({'left' : '0px'}, {duration : 400});
                              expanded = true;
                          }
                          else
                          {
                             $(this).animate({'left' : '565px'}, {duration: 400});
                              expanded = false;
                          }
                      });
 });

//please check this link
http://jsfiddle.net/3DpfJ/5/
 
PREVIOUS NEXT
Tagged: #move #element #onclick #javascript
ADD COMMENT
Topic
Name
6+2 =