Jquery off click function?

This question already has an answer here:

  • How do I detect a click outside an element? 76 answers

  • This should work for you:

    $('html').click(function() {
        $("#navLeft").hide();
    });
    

    And then be sure to prevent the event from propagating when clicking the #frame_left element:

    $("#frame_left").click(function(e) {
        $("#navLeft").show();
        e.stopPropagation();
    });
    

    Add a click event for the entire document:

    $(document).click(function(e) {
      $('#navLeft').hide();
    });
    

    Then stop propagation on the element, so it doesn't bubble up to the document:

    $("#frame_left").click(function(e) {
      e.stopPropagation();
      $("#navLeft").show();
    });
    

    http://api.jquery.com/event.stopPropagation/

    链接地址: http://www.djcxy.com/p/14706.html

    上一篇: 如何在除了一个div之外的任何地方点击时用jquery隐藏div?

    下一篇: jquery关闭点击功能?