How can I modify product page images and title for mobile view?

How can I modify product page images and title for mobile view?

harrisness
Shopify Partner
30 0 5

Hi, I am looking to modify my product page to look like my old website. I've done a good amount of CSS to get it to look close but there are some things I can't figure out.

1. How to show image thumbnails on mobile and not be able to slide through the pictures. When you click the image it has a quick fade transition and the old thumbnails are 50px x 50px squares

2. How to move the product title above the image on mobile

3. How to change the style of the size selector and the quantity input

 

I'm using Dawn 8.0.0 and my Shopify link is https://droughtinc.myshopify.com/products/explorer-shirt-1-1

 

Any help on how to solve these problems would be much appreciated. I attached 2 pictures below, one of the old and one of the new.

 

Screenshot 2023-02-23 at 8.31.53 PM.pngScreenshot 2023-02-23 at 8.37.02 PM.png

Replies 5 (5)

mics
Trailblazer
172 12 34

To modify your product page on your Shopify store, you'll need to make some changes to the code in your theme. Here are some tips for each of the changes you mentioned:

  1. To show image thumbnails on mobile, you can add some custom CSS to your theme's code. Here's an example of CSS code that you can use:

css

.product-single__thumbnails { display: block !important; } .product-single__thumbnail-item { width: 50px; height: 50px; margin-right: 10px; margin-bottom: 10px; } .product-single__thumbnail-item img { max-width: 50px; max-height: 50px; object-fit: contain; }

This code targets the thumbnail elements on your product page and sets them to display on mobile devices. It also styles the thumbnails to be 50px x 50px squares with a margin between them. The object-fit property ensures that the images are contained within the thumbnail boxes.

To prevent the ability to slide through the pictures, you can remove the product image slider from the product page. Here's how to do that:

  • In your theme editor, open the "product-template.liquid" file.
  • Find the section of code that starts with {% section 'product-template' %} and ends with {% endsection %}.
  • Inside that section of code, look for the code that generates the image slider. It should look something like this:

Copy code

{% include 'product-image' with image: featured_image, show_secondary_thumbnails: section.settings.show_secondary_thumbnails %}

  • Delete that code, and save the file.

This will remove the slider and leave only the main product image on the product page.

  1. To move the product title above the image on mobile, you can add some custom CSS to your theme's code. Here's an example of CSS code that you can use:

cssCopy code

@media (max-width: 767px) { .product-single__meta { flex-direction: column; align-items: flex-start; margin-bottom: 20px; } .product-single__title { margin-bottom: 10px; } }

This code targets the product title and metadata elements on your product page and styles them to display in a column on mobile devices. The flex-direction and align-items properties ensure that the elements are aligned vertically, and the margin-bottom property adds some spacing between them.

  1. To change the style of the size selector and quantity input, you can add some custom CSS to your theme's code. Here's an example of CSS code that you can use:

cssCopy code

.product-form__input {

  border: 1px solid #ccc;

  padding: 10px;

  font-size: 16px;

  font-weight: 400;

}

 

.product-form__input--select {

  appearance: none;

  padding-right: 25px;

  background: url('data:image/svg+xml,%3Csvg width="8" height="5" viewBox="0 0 8 5" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M.61 0L0 .614 2.49 3.36 0 3.375v1.154l3.86-.008.635.62.635-.62L8 4.529V3.375l-2.49-.015 2.49-2.747L5.5.614.61 0z" fill="%239B9B9B" fill-rule="evenodd"/%3E%3C/svg%3E') no-repeat center right / 10px 10px;

}

 

.product-form__input--number {

  width: 70px;

  text-align: center;

}

continue

This code targets the input elements on the product form and styles them with a border, padding, font size, and font weight. The appearance property removes the default styling of the select element, and the background property adds a custom arrow icon to the select element. You can customize the appearance of the arrow by editing the SVG code in the background property.

To apply these changes to your Shopify store, you'll need to add the custom CSS code to your theme's code. Here's how to do that:

  1. In your Shopify admin, go to Online Store > Themes.
  2. Find the theme you want to edit and click the "Actions" button, then select "Edit code".
  3. In the code editor, open the "assets" folder and create a new file called "custom.css".
  4. Copy and paste the custom CSS code into the "custom.css" file, and save the file.
  5. In the code editor, open the "theme.liquid" file.
  6. Find the closing </head> tag and add the following code above it:

{{ 'custom.css' | asset_url | stylesheet_tag }}

This code links to the "custom.css" file and adds it to your theme's stylesheet.

  1. Save the "theme.liquid" file.

Once you've made these changes, you should see the updated product page on your Shopify store. Keep in mind that modifying your theme's code can affect the functionality of your store, so it's a good idea to make a backup of your theme before making any changes.

 

banned
harrisness
Shopify Partner
30 0 5

              

harrisness
Shopify Partner
30 0 5

Hey, I really want to thank you for your time and help with these changes, I did follow all of your steps and added all of the code you suggested but I couldn't get any one of these things to change at all, is the code you wrote working with Dawn 8.0.0 ?

mics
Trailblazer
172 12 34

Pm me with details and store URL 

banned
sangeeta_boochr
Visitor
1 0 0

can you please help me to resolve the product page image issue :
below is the product page link for you reference :https://sangeetaboochra.com/products/beautiful-karishma-tanna-in-sangeeta-boochra-necklace-and-bangl...