Ninja Slider / Posts /

how can I change the aspect ratio for different devices to make slider responsive?

4

I have the aspect ratio: 2:1 for the image slider but this image size is for all screens. I want to change it like "media queries in css" maybe in width in 240px screen the aspect ratio can be 2:2 and 480px screen change it to 2:1... it is possible in javascript or css?

Hans  one year ago   viewed: 1479    

2 Answers

2

Good question!

You can update the aspect ratio of your image slider by setting the padding-top of the UL element for certain devices through the media queries in the stylesheet. For example, if you want 2:1 for mobile 480px devices:

@media (max-width:480px) { #ninja-slider ul { padding-top:50%!important; } }

Note the !important is required to overwrite the aspectRatio option in the ninja-slider.js.

Milo   one year ago
1

it works!!!!
thank you so much!!!

Hans   one year ago

   

Your name*
Password
(Optional. Used to modify this post afterwords)
+ =  

Ask your Own Question

  • If your question is related to the topic of this post, you can post your question to this page by clicking the "Post a reply" button at left;

  • When you want to start a new page for your question: