A
AAaron123
I've use .js files that had functions in them without problems.
I found the below JavaScript on the internet an would like to try it.
Mostly, just to see it work and play with it.
However I can't find out how to use it.
I have a JavaScript book (not all read yet) but can't find a similar example
in it.
I wonder if the name "handler" indicates that it is not just another
function.
It's the function in a function, and the fact that it seems to need to be
initialized or instantiated that has me stumped.
Maybe, if you can just point me in the correct direction I can move along.
Thanks
//Allows you to zoom individual images using an image toolbar appearing
whenever you hold your mouse over an image.
(function() {
// === User Configuration ===
var menuShowTimeOut = 0.5; // seconds
var minimalImageWidth = 32; // minimal width of the images the menu is
activated for
var minimalImageHeight = 32; // minimal height of the images the menu is
activated for
// === Code ===
var t = 0;
var menuBuilt = 0;
var menu, image, pixelLeft, pixelTop, menuBuilt;
function handler(o) {
if (menuBuilt && menu.style.visibility == "visible") {
return;
}
image = o;
if (!image.original_width) {
image.original_width = o.clientWidth;
image.original_height = o.clientHeight;
image.zoomlevel = 1;
}
pixelLeft = o.offsetLeft;
pixelTop = o.offsetTop;
...snip..
I found the below JavaScript on the internet an would like to try it.
Mostly, just to see it work and play with it.
However I can't find out how to use it.
I have a JavaScript book (not all read yet) but can't find a similar example
in it.
I wonder if the name "handler" indicates that it is not just another
function.
It's the function in a function, and the fact that it seems to need to be
initialized or instantiated that has me stumped.
Maybe, if you can just point me in the correct direction I can move along.
Thanks
//Allows you to zoom individual images using an image toolbar appearing
whenever you hold your mouse over an image.
(function() {
// === User Configuration ===
var menuShowTimeOut = 0.5; // seconds
var minimalImageWidth = 32; // minimal width of the images the menu is
activated for
var minimalImageHeight = 32; // minimal height of the images the menu is
activated for
// === Code ===
var t = 0;
var menuBuilt = 0;
var menu, image, pixelLeft, pixelTop, menuBuilt;
function handler(o) {
if (menuBuilt && menu.style.visibility == "visible") {
return;
}
image = o;
if (!image.original_width) {
image.original_width = o.clientWidth;
image.original_height = o.clientHeight;
image.zoomlevel = 1;
}
pixelLeft = o.offsetLeft;
pixelTop = o.offsetTop;
...snip..