Should add a visual test for the standard show/hide method to make sure we don't break it by overriding it

This commit is contained in:
gnarf 2011-03-02 19:46:19 -06:00
parent 2ad1cf3319
commit 0b18671d28
2 changed files with 19 additions and 3 deletions

View File

@ -174,6 +174,12 @@
</div> </div>
</li> </li>
<li>
<div class="effect" id="hide">
<p>hide/show (jQuery)</p>
</div>
</li>
</ul> </ul>
</body> </body>

View File

@ -1,5 +1,6 @@
$(function() { $(function() {
var duration = 1000, wait = 500;
$("div.effect") $("div.effect")
.hover(function() { $(this).addClass("hover"); }, .hover(function() { $(this).addClass("hover"); },
@ -13,16 +14,25 @@ $(function() {
$(el).bind("click", function() { $(el).bind("click", function() {
$(this).addClass("current").hide(n, o, 1000, function() { $(this).addClass("current").hide(n, o, duration, function() {
var self = this; var self = this;
window.setTimeout(function() { window.setTimeout(function() {
$(self).show(n, o, 1000, function() { $(this).removeClass("current"); }); $(self).show(n, o, duration, function() { $(this).removeClass("current"); });
},500); }, wait);
}); });
}); });
}; };
$("#hide").click(function() {
var el = $(this);
el.addClass("current").hide(duration, function() {
setTimeout(function() {
el.show(duration, function() { el.removeClass("current") });
}, wait);
})
})
effect("#blindHorizontally", "blind", { direction: "horizontal" }); effect("#blindHorizontally", "blind", { direction: "horizontal" });
effect("#blindVertically", "blind", { direction: "vertical" }); effect("#blindVertically", "blind", { direction: "vertical" });