开发者

Bringing a div back from .hide or .fadeOut onclick

开发者 https://www.devze.com 2023-04-05 22:23 出处:网络
Okay, so this is the example HTML. <a href=\"http://www.google.com/\"> <div id=\"link\"> This is a link

Okay, so this is the example HTML.

<a href="http://www.google.com/">
 <div id="link">
  This is a link
 </di开发者_如何学Gov>
</a>

<div class="example">
 Example div 1
</div>

<div class="example">
 Example div 2
</div>

<div class="example">
 Example div 3
</div>

Whenever #link is clicked, all the divs with the class .example are hidden.

$("#link").click(function ( event ) {
  $(".example").hide();
});

or

$("#link").click(function ( event ) {
  $(".example").fadeOut("fast");
});

Now whenever any spot on the page is clicked, all of the .example divs return.

Is it possible? It doesn't all necessarily have to be done with jQuery.

Thanks in advance.


$('body').live('click', function() {
    $(".example").show();
});
0

精彩评论

暂无评论...
验证码 换一张
取 消