Fix custom themed WooCommerce Gallery
- or -
Post a project like this113
£30/hr(approx. $38/hr)
- Posted:
- Proposals: 51
- Remote
- #4122070
- Awarded
WordPress | Shopify | WooCommerce | Divi | Elementor | WP Bakery | Malware Removal and Security
Sirajganj
Designer and Developer|WordPress|Shopify|PSD|PHP HTML, JavaScript|WIX| PowerPoint/Keynote| Logo Designing
Berlin
Expert WordPress, PHP, Shopify, WIX, SEO, Magento, Photoshop, Illustrator Designer and Developer
City of London
SEO | PHP | WordPress |Salesforce |Zoho|UI/UX |MERN|Full Stack Development|Logo | Graphic Design
Agra
PPH #1 "Top Rated" Service Provider in Development & IT : Wordpress, Shopify, Magento, Squarespace, ZOHO, WHMCS, Salesforce, Vtiger, Learndash, Moodle
Kenwick
266511449530325668717417538138114783674494319813224990062390124243922626932712537323
Description
Experience Level: Expert
I have a site that I'm building on WordPress. It's got a Woocommerce store but I'm having issues with the product gallery. When I click the gallery image it doesn't load that image in the main image space.
You can see what I mean here - https://wbs.mhwddev.co.uk/product/bsc3/
I've tried with the following code but it doesn't seem to work.
jQuery(document).ready(function($) {
$('.woocommerce-product-gallery__wrapper').on('click', 'a', function(e) {
e.preventDefault();
var imageUrl = $(this).find('img').attr('data-src');
console.log(imageUrl);
$('#main-image img').attr('src', imageUrl);
});
});
You can see what I mean here - https://wbs.mhwddev.co.uk/product/bsc3/
I've tried with the following code but it doesn't seem to work.
jQuery(document).ready(function($) {
$('.woocommerce-product-gallery__wrapper').on('click', 'a', function(e) {
e.preventDefault();
var imageUrl = $(this).find('img').attr('data-src');
console.log(imageUrl);
$('#main-image img').attr('src', imageUrl);
});
});
Michael H.
100% (3)Projects Completed
4
Freelancers worked with
3
Projects awarded
100%
Last project
17 Apr 2024
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
Hi Michael,
Have you managed to resolve this now?
As the other developer has pointed out, it's not the best code implementation to be honest as it won't change the responsive image HTML code.
Is there a particular reason why you decided to not just use the default WooCommerce gallery and just disable the features of the gallery that you didn't want...? Ie. zoom etc.?
Kind regards,
Matthew -
Hello Michael,
Have you tried any better gallery plugins for this? I have checked the js you are using and only changed the src but the image tag has srcset which defines different image formats for different screen sizes.
10825071082479
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies