effects.test: adding a test for size using toggle

This commit is contained in:
gnarf 2011-05-04 23:40:16 -05:00
parent c73e40adbe
commit d4bdd19429
2 changed files with 22 additions and 7 deletions

View File

@ -147,7 +147,13 @@
<li> <li>
<div class="effect" id="size"> <div class="effect" id="size">
<p>Size</p> <p>Size Default Show/Hide</p>
</div>
</li>
<li>
<div class="effect" id="sizeToggle">
<p>Size Toggle</p>
</div> </div>
</li> </li>

View File

@ -28,10 +28,10 @@ $(function() {
var el = $(this); var el = $(this);
el.addClass("current").hide(duration, function() { el.addClass("current").hide(duration, function() {
setTimeout(function() { setTimeout(function() {
el.show(duration, function() { el.removeClass("current") }); el.show(duration, function() { el.removeClass("current"); });
}, wait); }, wait);
}) });
}) });
effect("#blindLeft", "blind", { direction: "left" }); effect("#blindLeft", "blind", { direction: "left" });
effect("#blindUp", "blind", { direction: "up" }); effect("#blindUp", "blind", { direction: "up" });
@ -61,7 +61,16 @@ $(function() {
effect("#puff", "puff", { times: 2 }); effect("#puff", "puff", { times: 2 });
effect("#scale", "scale", {}); effect("#scale", "scale", {});
effect("#size", "size", { from: { width: 300, height: 300 }}); effect("#size", "size", {});
$("#sizeToggle").bind("click", function() {
var opts = { to: { width: 300, height: 300 }};
$(this).addClass('current')
.toggle("size", opts, duration)
.delay(wait)
.toggle("size", opts, duration, function() {
$(this).removeClass("current");
});
});
$("#shake").bind("click", function() { $(this).addClass("current").effect("shake", {}, 100, function() { $(this).removeClass("current"); }); }); $("#shake").bind("click", function() { $(this).addClass("current").effect("shake", {}, 100, function() { $(this).removeClass("current"); }); });
@ -83,13 +92,13 @@ $(function() {
$("#removeClass").click(function() { $("#removeClass").click(function() {
$(this).addClass("current").removeClass(function() { $(this).addClass("current").removeClass(function() {
window.console && console.log(arguments); window.console && console.log(arguments);
return "current" return "current";
}, duration); }, duration);
}); });
$("#toggleClass").click(function() { $("#toggleClass").click(function() {
$(this).toggleClass(function() { $(this).toggleClass(function() {
window.console && console.log(arguments); window.console && console.log(arguments);
return "current" return "current";
}, duration); }, duration);
}); });
}); });