Product image in mobile too large

  • Posts: 70
  • Thank you received: 3
3 years 3 weeks ago #339571

-- url of the page with the problem -- : deborahblyth.com
-- HikaShop version -- : 4.4.5
-- Joomla version -- : 3.10.6
-- PHP version -- : 7.4.25

Hi, I have an issue where my product image has a set size of 670px in all views. When in mobile the block it sits in is still 670px and then takes up too much white space: See here in mobile, you will see lots of white space below the image:
deborahblyth.com/rings/jewelry/the-venus-ring

The code shows the height of 670 as inline css:

<div class="hikashop_product_main_image_thumb hikashop_img_mode_classic" id="hikashop_image_main_thumb_div" style="height:670px;">

I have noticed that in the file 'show_block_img.php' it takes the image size and adds 20px. This is fine for desktop but how do I make it work for mobile? In the Product page image (width x height) it only allows one value and not a sepertae one for mobile.

<div style="<?php if(!empty($divHeight) && !$this->config->get('image_force_size',true)){ echo 'height:'.($divHeight+20).'px;'; } ?>text-align:center;clear:both;" class="hikashop_product_main_image">

Please Log in or Create an account to join the conversation.

  • Posts: 4816
  • Thank you received: 654
  • MODERATOR
3 years 3 weeks ago #339580

Hello,

Unless we're mistaken, you're not using the HikaShop frontend template at all, and so you have to know that responsive commands are in HikaShop frontend css file.

Now, on this specific case you can unset the container div with this kind of command :

div#hikashop_image_main_thumb_div {
    height: unset !important;
}
And, in order to restrict this command only when it's required here phone screen
@media only screen and (max-width: 600px) {
    div#hikashop_image_main_thumb_div {
        height: unset !important;
    }
}
Here, the "600px" value is just an example, define where it fits your needs.
Learn more about the "@media" command, here .

Regards
Team HikaShop

Last edit: 3 years 3 weeks ago by Philip.
The following user(s) said Thank You: Valserine

Please Log in or Create an account to join the conversation.

  • Posts: 70
  • Thank you received: 3
3 years 3 weeks ago #339587

Hi, thanks for that, it solved my issue but only on the main image, as soon as I click a different variant, like gold or silver the css changes to hikashop_image_main_thumb_div_22 adding '_ and a number' how do I control all of these numbers?

Thanks.

Last edit: 3 years 3 weeks ago by spytech.

Please Log in or Create an account to join the conversation.

  • Posts: 4816
  • Thank you received: 654
  • MODERATOR
3 years 3 weeks ago #339598

Hello,

Then, we think that the quickest move for solve your responsive issue is to use the default HikaShop frontend css.
Now, if you have remove this css file on purpose, if you detail why maybe we can guide you to another way to proceed.
Regards

Please Log in or Create an account to join the conversation.

  • Posts: 22
  • Thank you received: 1
2 years 11 months ago #340612

Hi,

I know that i should open my own thread but you gave me a part of the solution for my case, here, Philip.
I applied your code about media in my frontend custom css and it works great for the main image.
unfortunately it doesn't apply to the image of my variants (characteristics) i tried the following command but it doesn't change anything :

@media only screen and (max-width: 600px) {
div#hikashop_image_variant_thumb_div {
height: unset !important;
}

i guess i have to replace the word "variant" but by which word ?
thanks.

Please Log in or Create an account to join the conversation.

  • Posts: 4816
  • Thank you received: 654
  • MODERATOR
2 years 11 months ago #340613

Hello,

In order to get your required element class you can use your navigator inspector tool, follow me step by step :
1. Point your element (in your case after the variant thumbnail is displayed)
2. right-click => Inspect (inspector tool from navigator to another)
3. This will open a new window will display your page Html, and with it your pointed element class.

Hope this will help you to adapt your code.
Regards

Last edit: 2 years 11 months ago by Philip.

Please Log in or Create an account to join the conversation.

  • Posts: 22
  • Thank you received: 1
2 years 11 months ago #340627

Hello

That's what i did. In fact in the first (the main image) it is written :

<div class= "hikashop_product_main_image_thumb.... id="hikashop_main_image_thumb_div">

and for the variant image :

<div id="hikashop_main_image_div_155..

so i wrote in the frontend custom :

@media only screen and (max-width: 600px) {
div#hikashop_image_main_thumb_div_XXX {
height: unset !important;
}

but it doesn't change anything again. and it seems to be the same thing which Spytech described. but i use the hikashop frontend.

i give you the link example (may be i am not good at reading with the inspector code) : example with variants

regards

Please Log in or Create an account to join the conversation.

  • Posts: 22
  • Thank you received: 1
2 years 11 months ago #340635

Hello again

in fact i found the perfect solution in this thread

thank you for your help.
enjoy your sunday

The following user(s) said Thank You: nicolas

Please Log in or Create an account to join the conversation.

Time to create page: 0.091 seconds
Powered by Kunena Forum