How To

How to set image gallery Fotorama thumbnail as vertical view in Magento 2

Hello, Magento folks,

Last time we learned how you can create custom UI Component using knowckout.js in Magento 2.

Today, we are going to learn how you can change thumbnail in image gallery fotorama for any product page from horizontal to vertical.

Sometimes there are images that look better when their alignment is set as vertical rather than horizontal. You might want to change that, but you found no solution for that.

Well, we are here to solve the issue you are having. With the help of view.xml file for a gallery that is used by Magento, you can shift the view of your images from horizontal to vertical and vice-versa as you need.

Follow the instructions given below to set gallery fotorama thumbnail as a vertical view on the product view page.

Find a variable named navdir at given below path:

app\design\frontend\Themes\Yourtheme\etc\view.xml

In this file, you can see a variable navdir search under <var name= “gallery”> tag.

You need to replace the below code:

<var name="navdir">horizontal</var>

With this code

<var name="navdir">vertical</var>

You can define your own custom view in the same file at the given path.

You can also set your custom view on mobile devices as well. To do that you need to define the condition for mobile in the available breakpoint variable. Change the alignment of image thumbnail as vertical or horizontal by placing navdir variable, as shown below.

<var name="breakpoints">
<var name="mobile">
<var name="conditions">
<var name="max-width">767px</var>
</var>
<var name="options">
<var name="options">
<var name="navdir">vertical</var>
</var>
</var>
</var>
</var>

So, this was it. Using this you can set the thumbnail of fotorama gallery image as vertical. You can do this mobile too. If you have any problem while implementation, then contact our support team for help. We will be happy to help you. Lastly, if you like this article, then let us know in the comments below. Also, make sure that you share this with your Magento colleagues and friends.

Happy Reading!

Click to rate this post!
[Total: 15 Average: 4.9]
Dhiren Vasoya

Dhiren Vasoya is a Director and Co-founder at MageComp, Passionate ?️ Certified Magento Developer?‍?. He has more than 9 years of experience in Magento Development and completed 850+ projects to solve the most important E-commerce challenges. He is fond❤️ of coding and if he is not busy developing then you can find him at the cricket ground, hitting boundaries.?

View Comments

Recent Posts

How to Add Tooltip in Checkout Shipping Field in Magento 2?

Hello Magento Friends, In today’s blog, I will explain How to Add Tooltip in Checkout…

3 days ago

How to Integrate and Use MongoDB with Laravel?

MongoDB is a popular NoSQL database that offers flexibility and scalability when handling modern web…

4 days ago

NodeJS | Callback Function

In NodeJS, callbacks empower developers to execute asynchronous operations like reading files, handling requests, and…

5 days ago

How to Show SKU in Order Summary in Magento 2?

Hello Magento Friends, In today’s blog, we will learn How to Show SKU in Order…

7 days ago

Best Colors to Use for CTA Buttons

The "Buy Now" and "Add to Cart" buttons serve as the primary call-to-action (CTA) elements…

1 week ago

Magento 2: How to Save Custom Field Value to quote_address for Multi-Shipping Orders

Hello Magento Friends, In Magento 2, the checkout process allows customers to choose multiple shipping…

1 week ago