jquery toggle

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$(function() {
$("#go").toggle(
function() {$("#test").css("position","absolute").animate({width: 150}, 2000);},
function() {$("#test").css("position","absolute").animate({width: 300}, 2000);}
);
});
$(function() {
$("#go").toggle(
function() {$("#test").animate({opacity: 0}, 2000, function(){console.log("hi there");});},
function() {$("#test").animate({opacity: 1}, 2000);}
);
});
$(function() {
$("#go").toggle(
function() {$("#test").animate({width: $("#test").width() + 50}, 2000, function(){console.log("hi there");});},
function() {$("#test").animate({width: $("#test").width() - 50}, 2000);}
);
});