Can't get started with this JavaScript

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..
 
G

Guest

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
 
G

Gregory A. Beamer

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.
 
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..

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top