{"id":452,"date":"2009-06-03T17:05:04","date_gmt":"2009-06-03T15:05:04","guid":{"rendered":"https:\/\/devpath.pro\/?p=452"},"modified":"2009-06-03T17:05:04","modified_gmt":"2009-06-03T15:05:04","slug":"ita-gli-eventi-onmouseenter-onmouseleave-su-tutti-i-browser","status":"publish","type":"post","link":"https:\/\/fabiocicerchia.it\/web\/ita-gli-eventi-onmouseenter-onmouseleave-su-tutti-i-browser","title":{"rendered":"[ITA] Gli eventi onMouseEnter & onMouseLeave su tutti i browser"},"content":{"rendered":"\n

Utilizzare gli eventi onMouseEnter & onMouseLeave non solo su Internet Explorer non sar\u00e0 pi\u00f9 un problema! Basta una funzioncina javascript e prototype.<\/p>\n\n\n\n

function extendMouseEvents(e) {
var elem = e.element();
var target = e.relatedTarget;
var p = stop = null;
if (!target || (elem !== target && !target.descendantOf(elem))) {
if (target && elem.descendantOf(target)) stop = target.childElements();
else if (target) {
p = elem.up();
while (!target.descendantOf(p)) p = p.up();
if (target.descendantOf(p)) stop = p.childElements();
}
if (stop) stop.invoke('observe', 'custom:mouseleave', function(e) { e.stop(); });
elem.fire('custom:mouseleave');
if (stop) stop.invoke('stopObserving', 'custom:mouseleave', function(e) { e.stop(); });
}
p = stop = null;
if (target && !elem.descendantOf(target)) {
if (!target.descendantOf(elem)) {
p = target.up();
while (!elem.descendantOf(p)) p = p.up();
stop = p.childElements();
} else
stop = elem.childElements();
if (stop) stop.invoke('observe', 'custom:mouseenter', function(e) { e.stop(); });
target.fire('custom:mouseenter');
if (stop) stop.invoke('stopObserving', 'custom:mouseenter', function(e) { e.stop(); });
}
}
Event.observe(document, 'mouseout', extendMouseEvents);<\/pre>\n\n\n\n

L\u2019utilizzo \u00e8 semplice:<\/p>\n\n\n\n

Event.observe(element, 'custom:mouseenter', my_function_1);
\/\/ oppure<\/em>
Event.observe(element, 'custom:mouseleave', my_function_2);<\/pre>\n","protected":false},"excerpt":{"rendered":"

Utilizzare gli eventi onMouseEnter & onMouseLeave non solo su Internet Explorer non sar\u00e0 pi\u00f9 un problema! Basta una funzioncina javascript e prototype. function extendMouseEvents(e) { var elem = e.element(); var target = e.relatedTarget; var p = stop = null; if (!target || (elem !== target && !target.descendantOf(elem))) { if (target && elem.descendantOf(target)) stop = target.childElements(); […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advgb_blocks_editor_width":"","advgb_blocks_columns_visual_guide":"","footnotes":""},"categories":[14],"tags":[74,11,12,103,104],"aioseo_notices":[],"author_meta":{"display_name":"fabio","author_link":"https:\/\/fabiocicerchia.it\/author\/fabio"},"featured_img":null,"coauthors":[],"tax_additional":{"categories":{"linked":["Web<\/a>"],"unlinked":["Web<\/span>"]},"tags":{"linked":["events<\/a>","italian<\/a>","javascript<\/a>","mouse<\/a>","prototype<\/a>"],"unlinked":["events<\/span>","italian<\/span>","javascript<\/span>","mouse<\/span>","prototype<\/span>"]}},"comment_count":"0","relative_dates":{"created":"Posted 15 years ago","modified":"Updated 15 years ago"},"absolute_dates":{"created":"Posted on June 3, 2009","modified":"Updated on June 3, 2009"},"absolute_dates_time":{"created":"Posted on June 3, 2009 5:05 pm","modified":"Updated on June 3, 2009 5:05 pm"},"featured_img_caption":"","series_order":"","_links":{"self":[{"href":"https:\/\/fabiocicerchia.it\/wp-json\/wp\/v2\/posts\/452"}],"collection":[{"href":"https:\/\/fabiocicerchia.it\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fabiocicerchia.it\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fabiocicerchia.it\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fabiocicerchia.it\/wp-json\/wp\/v2\/comments?post=452"}],"version-history":[{"count":0,"href":"https:\/\/fabiocicerchia.it\/wp-json\/wp\/v2\/posts\/452\/revisions"}],"wp:attachment":[{"href":"https:\/\/fabiocicerchia.it\/wp-json\/wp\/v2\/media?parent=452"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fabiocicerchia.it\/wp-json\/wp\/v2\/categories?post=452"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fabiocicerchia.it\/wp-json\/wp\/v2\/tags?post=452"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}