这样做有什么区别:
$(".topHorzNavLink").click(function() {
var theHoverContainer = $("#hoverContainer");
var thisHorzLink = $(this).attr('linkItem');
if (thisHorzLink == "link2") {
if ($("#hoverContainer").is(":visible") == true) {
$("#hoverContainer").slideUp('slow');
} else {
$("#hoverContainer").slideDown('slow');
}
}
});
或这个:
$(".topHorzNavLink").click(function() {
var theHoverContainer = $("#hoverContainer");
var thisHorzLink = $(this).attr('linkItem');
if (thisHorzLink == "link2") {
if (theHoverContainer.is(":visible") == true) {
theHoverContainer.slideUp('slow');
} else {
theHoverContainer.slideDown('slow');
}
}
});