Results 1 to 4 of 4

Thread: jQuery for Featured Image Zoomer

  1. #1
    Join Date
    Apr 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Wink jQuery for Featured Image Zoomer

    1) Script Title: Featured Image Zoomer v1.5

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...uredzoomer.htm

    3) Describe problem:
    Featured Image Zoomer works fine in jQuery1.4.4~1.6.4.
    mouse can not be rollback small view in jQuery1.7.2(other plugin necessary),anyone could offer help?
    I love this script,don't want remove it.
    Thank you.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,167
    Thanks
    44
    Thanked 3,240 Times in 3,201 Posts
    Blog Entries
    12

    Default

    Looks like a bug in the later version of jQuery. They're not passing all of the required properties of the event in their version of the event object. Hopefully they'll fix that in a later update. In the meantime we can adapt featuredimagezoomer.js to the bug, because fortunately they do pass the original event object as a property of their version of it.

    Using a text only editor like NotePad, open up the featuredimagezoomer.js file, find this function and add the highlighted:

    Code:
    	magnifyimage: function($tracker, e, zoomrange){
    		if(!e.detail && !e.wheelDelta){e = e.originalEvent;}
    		var delta=e.detail? e.detail*(-120) : e.wheelDelta //delta returns +120 when wheel is scrolled up, -120 when scrolled down
    		var zoomdir=(delta<=-120)? "out" : "in"
    		var specs=$tracker.data('specs')
    		var magnifier=specs.magnifier, od=specs.imagesize, power=specs.curpower
    		var newpower=(zoomdir=="in")? Math.min(power+1, zoomrange[1]) : Math.max(power-1, zoomrange[0]) //get new power
    		var nd=[od.w*newpower, od.h*newpower] //calculate dimensions of new enlarged image within magnifier
    		magnifier.$image.css({width:nd[0], height:nd[1]})
    		specs.curpower=newpower //set current power to new power after magnification
    		specs.$statusdiv.html('Current Zoom: '+specs.curpower)
    		this.showstatusdiv(specs, 0, 500)
    		$tracker.trigger('mousemove')
    	},
    BTW - I just checked and this is a known bug but the ticket on it shows the developers balking at fixing it while claiming it's not a bug, so claiming it's fixed. See:

    http://bugs.jquery.com/ticket/10420

    for more info.
    Last edited by jscheuer1; 04-28-2012 at 04:26 PM. Reason: better solution
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    Mark_X (04-29-2012)

  4. #3
    Join Date
    Apr 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thanks John!
    I edit it well done. thank you very much!

    BTW, a little bit question about trace zone can't keep in right position (overlay at border) sometimes.

    Mark.

  5. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,167
    Thanks
    44
    Thanked 3,240 Times in 3,201 Posts
    Blog Entries
    12

    Default

    Other than get it away from the border, I'd have to see that to fix it.

    If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •