Can't get started with this JavaScript

  • Thread starter Thread starter AAaron123
  • Start date Start date
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'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..

Is it this one?
http://userjs.org/scripts/browser/enhancements/zoom-image

"A compliment to Opera's own zoom feature, this script allows you to
zoom individual images using an image toolbar appearing whenever you
hold your mouse over an image."

This is an "extension" to Opera browser
 
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.

SNIPPED

Not sure what is wrong with it at first glance, but if you want an image
zoom, try this:
http://www.javascriptkit.com/script/script2/imagezoom.shtml

It includes examples of how to use the control.



--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
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..

Is it this one?
http://userjs.org/scripts/browser/enhancements/zoom-image

"A compliment to Opera's own zoom feature, this script allows you to
zoom individual images using an image toolbar appearing whenever you
hold your mouse over an image."

This is an "extension" to Opera browser

Thanks
 
Back
Top