Can't get started with this JavaScript

Discussion in 'ASP .Net' started by AAaron123, Jun 25, 2009.

  1. AAaron123

    AAaron123 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..
     
    AAaron123, Jun 25, 2009
    #1
    1. Advertising

  2. On Jun 25, 6:55 pm, "AAaron123" <> wrote:
    > 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
     
    Alexey Smirnov, Jun 25, 2009
    #2
    1. Advertising

  3. "AAaron123" <> wrote in
    news:OZj#:

    > 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! |
    *******************************************
     
    Gregory A. Beamer, Jun 29, 2009
    #3
  4. AAaron123

    AAaron123 Guest

    "Alexey Smirnov" <> wrote in message
    news:...
    On Jun 25, 6:55 pm, "AAaron123" <> wrote:
    > 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
     
    AAaron123, Jul 10, 2009
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Allan Ford
    Replies:
    1
    Views:
    626
    Benjie Fallar
    Jul 15, 2003
  2. Sam Carleton

    Good book to get me started...

    Sam Carleton, Oct 27, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    386
    Alvin Bruney
    Nov 2, 2003
  3. rayreeves

    Can't get started

    rayreeves, Aug 9, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    286
    rayreeves
    Aug 9, 2007
  4. Guy
    Replies:
    2
    Views:
    205
    Dr John Stockton
    Dec 5, 2003
  5. Jake Barnes
    Replies:
    2
    Views:
    332
Loading...

Share This Page