Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 362229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:13:28+00:00 2026-05-12T13:13:28+00:00

I’m creating an e-commerce product page that will use jQZoom as a way of

  • 0

I’m creating an e-commerce product page that will use jQZoom as a way of zooming in on the featured product image. I’d like, however, the ability to click an alternate product photo thumbnail and have it not only replace the big, featured image, but also re-instantiate the jQZoom() funcion on the newly replaced featured image.

All of this works fine

The problem is this. The original, featured image that had jQZoom() applied to it on page-load still remains a “living artifact”, and when I hover() the replaced featured image, the zoom-effect is applied to the replaced image and the original image.

////////////////////////
Product Page

///////////////////////

/////////////////////////////////////////////
My Replacement Function

function SwapPic(image, image_big)
{

  $(".jqZoomWindow").remove();
  $(".jqZoomPup").remove();

  $('img.feature').attr("src",image);
  $('#product-image a').attr("href",image_big).jqzoom({
      zoomWidth: 330,
      zoomHeight: 330,
      showEffect:'show',
      hideEffect:'fadeout',
      fadeoutSpeed: 'slow',
      xOffset :72,
      title :false
    });
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T13:13:28+00:00Added an answer on May 12, 2026 at 1:13 pm

    Following the theme we started in jQuery Function Seems….
    your duplicate many code, but JS is not a fully object-oriented language, we can apply some techniques to avoid duplication of code, and take advantage of jQuery plugins

    I do not have time to test the script. So you’ll have what you need to modify if necessary. I hope it is a better approximation of what you need.

    Will have some discount if you buy clothes for my wife, jjejeje.

    (function($) {
    
     $.fn.SwapPic = function(options) {
    
      options = $.extend({
       zoomWidth: 330,
       zoomHeight: 330,
       showEffect:"show",
       hideEffect:"fadeout",
       fadeoutSpeed: "slow",
       xOffset:72,
       title:false,
       containerImgSmall: "",
       containerImgLarge: "",
       postAccion: null
      }, options || {});
    
      options.pthis = this;
      options.accion = function() {  
    
       imageSmall = $(options.pthis).attr("href"); //verifies this line
       imageLarge = $(options.pthis).attr("href").replace(/small/, "large"); //verifies this line
    
       options.containerImgSmall = $(options.containerImgSmall);
       options.containerImgLarge = $(options.containerImgLarge);
    
       //I do not know if it's necessary to do this
       if ($(".jqZoomWindow").length != 0)
        $(".jqZoomWindow").remove();
    
       //I do not know if it's necessary to do this
       if ($(".jqZoomPup").length != 0)
        $(".jqZoomPup").remove();
    
       options.containerImgSmall.attr("src", imageSmall);
    
       options.containerImgLarge.attr("href", imageLarge).jqzoom({
        zoomWidth:options.zoomWidth,
        zoomHeight:options.zoomHeight,
        showEffect:options.showEffect,
        hideEffect:options.hideEffect,
        fadeoutSpeed:options.fadeoutSpeed,
        xOffset:options.xOffset,
        title:options.title
       });
    
       if (options.postAccion!=null)
        options.postAccion.call();
      };
    
      $(this).bind("click", options.accion);
    
     };
    })(jQuery);
    
    $(document).ready(function(){
    
     var myPostAccion = function(){
      $('#product-images li:first').fadeIn("slow");
     };
    
     $(".a-class-1").SwapPic({
      containerImgSmall: "img.feature",
      containerImgLarge: "#product-image a",
      postAccion: myPostAccion
     });
    
     $(".a-class-2").SwapPic({
      zoomWidth: 530,
      zoomHeight: 530,
      containerImgSmall: "img.feature",
      containerImgLarge: "#product-image a",
      postAccion: myPostAccion
     });
    
    });
    

    HTML:

    <a class="product-thumbs a-class-1" href="http://cdn.shopify.com/s/files/1/0031/5672/products/n1_small.jpg?1252565016" ><img src="http://cdn.shopify.com/s/files/1/0031/5672/products/n1_thumb.jpg?1252565016" alt="text" /></a>
    <a class="product-thumbs a-class-2" href="http://cdn.shopify.com/s/files/1/0031/5672/products/n2_small.jpg?1252565016" ><img src="http://cdn.shopify.com/s/files/1/0031/5672/products/n2_thumb.jpg?1252565016" alt="text" /></a>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.