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"
1.eg.showthumb = function (group) {2.var ul = eg.$ ("smallphotoslist"); 3.ul.innerHTML = //to empty the old content every time it appears 4. var start = (group-1) *eg.groupsize; // Calculates the starting position of the data 5. var end = group*eg.groupsize //needed to calculate the end position of the data required 6. for (vari= Start; (i<end&&i<eg.data.length); i++) {7. var li = document.createelement ("Li") );8. li.innerhtml = ' 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 JavaScript650) this.width=650; "Src=" http://img.blog.csdn.net/20141022142905591?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqva2dzzxc=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "style=" Border:none; "/>
JavaScript, JQuery, HTML5, node. js instances Daquan-Reading notes 3