26 lines
819 B
JavaScript
Raw Normal View History

2021-03-31 21:56:49 -04:00
"use strict";
$(document).ready(() => {
// process each img tag
$("#image_rollovers img").each( (index, img) => {
const oldURL = img.src; // gets the src attribute
const newURL = img.id; // gets the id attribute
// preload rollover image
const rolloverImage = new Image();
rolloverImage.src = newURL;
// set up event handlers for changing images
$(img).mouseover( () => img.src = newURL );
$(img).mouseout( () => img.src = oldURL);
// set up event handlers for hovering over an image
// $(img).hover( // use jQuery syntax to access hover() method
// () => img.src = newURL, // hover over
// () => img.src = oldURL // hover out
// );
});
});