Jump to content

Detect the product main image in the product page with javascript


Recommended Posts

Hi,

i'm developping a module that provide some kind of zoom to the main product image in the product page.

The problem that i don't know how to detect that image with jquery when the theme is changed. Because the customer can change the theme.

 

for example is there a class that exist in all kind of themes in prestashop that i can refer it with jquery to apply my jquery script ?

For example something like this :

$(".main-product-img").some_jquery_function("......")

where the "main-product-img" class is the class that i can find in any theme in prestashop ?

 

If no, has anyone an idea how to do that without a css class ?

Link to comment
Share on other sites

 

for example is there a class that exist in all kind of themes in prestashop that i can refer it with jquery to apply my jquery script ?

 

no, each developer can use own unique css styles and own unique js scripts. each theme can be just different.

Link to comment
Share on other sites

thanks Vekia for the reply.

 

So if i want to develop a module that make a zoom in the product image, how can i attach the module to the product page and make it work when cliking the main image  of the product in that page ??

Link to comment
Share on other sites

in fact, you can't create universal solution.

as i mentioned developer of the theme can totally change the way of how product page works...

usually developers trying to avoid that, but there are many of them, that don't care about that.

 

just create module for default-bootstrap theme

Link to comment
Share on other sites

×
×
  • Create New...