JavaScript, JQuery, HTML5, node. js instances Daquan-Reading notes 3

Source: Internet
Author: User

A lot of technology, many examples, had to slowly learn, slowly practice!! Now this book is "JavaScript real-time----JavaScript, jQuery, HTML5, and node. js instance Daquan"

JavaScript, JQuery, HTML5, node. js instances Daquan-Reading notes 2

3.3 Responding to mouse actions

The effect of Figure 3-2 is already in place, and you need the mouse to manipulate the photos you want to see, which you need to add events to.

3.3.1 Response Small Photo click action

The Eg.showthumb () method, which displays a list of small images in the 3.2.3 code, displays a large picture when a small picture is clicked, which calls the Eg.showbig () method, which responds to the Click event only when the small picture is clicked, so you need to use the Eg.addlistener () method, see "Example 3-4" for specific code.

"Example 3-4 response to a small photo click action"

The 9th line in "Example 3-4" is the code that responds to the small photo click action, which uses a closure, a self-invoking anonymous function. (function () {}) () is the simplest closure. The contents of the curly braces are executed sequentially. If you remove lines 9th and 14th, you will find that the last 1 of the current group photos are always displayed, and in the body of the for statement you typically use closures to pass the values of variables to internal binding events.

The most soldier assault combat type JavaScript



JavaScript, JQuery, HTML5, node. js instances Daquan-Reading notes 3

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.