Knowledge Walls
Gopal Rao
Mumbai, Maharashtra, India
Passcode:
Jquery mousedown example in Jquery functions of JQuery Examples
2769 Views
Hints 
When you press the mouse button(i.e the button moving down) the mousedown() called.And when you release the mouse button(i.e the button moving up) the mouseup() function called.

In the following example When you press the element one div will appear, when you release the button the div will hide.
Example code
<html>

<head>
    <title>HTML-JQuery</title>
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>

    <script type="text/javascript">
        $(function () {
            $(".one").mousedown(function () {
                $(".two").show();
            });
            $(".one").mouseup(function () {
                $(".two").hide();
            });
        });
    </script>
    <style type="text/css">
        .two {
            display: none;
        }
    </style>
</head>

<body>
    <div class="one">click this element</div>
    <div class="two">you pressing the element</div>
</body>

</html>
Example demo 
Previous Topics
Previous lessons of current book.
Best Lessons of "JQuery Examples"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details