Add image hover event listeners only when needed.
This commit is contained in:
parent
b1f257fbd9
commit
24440ad0ad
@ -3313,16 +3313,21 @@
|
|||||||
node: function(root) {
|
node: function(root) {
|
||||||
var thumb;
|
var thumb;
|
||||||
if (!(thumb = $('img[md5]', root))) return;
|
if (!(thumb = $('img[md5]', root))) return;
|
||||||
$.on(thumb, 'mouseover', imgHover.mouseover);
|
return $.on(thumb, 'mouseover', imgHover.mouseover);
|
||||||
$.on(thumb, 'mousemove', ui.hover);
|
|
||||||
return $.on(thumb, 'mouseout', ui.hoverend);
|
|
||||||
},
|
},
|
||||||
mouseover: function() {
|
mouseover: function() {
|
||||||
ui.el = $.el('img', {
|
ui.el = $.el('img', {
|
||||||
id: 'ihover',
|
id: 'ihover',
|
||||||
src: this.parentNode.href
|
src: this.parentNode.href
|
||||||
});
|
});
|
||||||
|
$.on(this, 'mousemove', ui.hover);
|
||||||
|
$.on(this, 'mouseout', imgHover.mouseout);
|
||||||
return $.add(d.body, ui.el);
|
return $.add(d.body, ui.el);
|
||||||
|
},
|
||||||
|
mouseout: function() {
|
||||||
|
ui.hoverend();
|
||||||
|
$.off(this, 'mousemove', ui.hover);
|
||||||
|
return $.off(this, 'mouseout', imgHover.mouseout);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -2612,13 +2612,17 @@ imgHover =
|
|||||||
node: (root) ->
|
node: (root) ->
|
||||||
return unless thumb = $ 'img[md5]', root
|
return unless thumb = $ 'img[md5]', root
|
||||||
$.on thumb, 'mouseover', imgHover.mouseover
|
$.on thumb, 'mouseover', imgHover.mouseover
|
||||||
$.on thumb, 'mousemove', ui.hover
|
|
||||||
$.on thumb, 'mouseout', ui.hoverend
|
|
||||||
mouseover: ->
|
mouseover: ->
|
||||||
ui.el = $.el 'img'
|
ui.el = $.el 'img'
|
||||||
id: 'ihover'
|
id: 'ihover'
|
||||||
src: @parentNode.href
|
src: @parentNode.href
|
||||||
|
$.on @, 'mousemove', ui.hover
|
||||||
|
$.on @, 'mouseout', imgHover.mouseout
|
||||||
$.add d.body, ui.el
|
$.add d.body, ui.el
|
||||||
|
mouseout: ->
|
||||||
|
ui.hoverend()
|
||||||
|
$.off @, 'mousemove', ui.hover
|
||||||
|
$.off @, 'mouseout', imgHover.mouseout
|
||||||
|
|
||||||
imgGif =
|
imgGif =
|
||||||
init: ->
|
init: ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user