malihu / malihu-custom-scrollbar-plugin

Highly customizable custom scrollbar jQuery plugin, featuring vertical/horizontal scrollbars, scrolling momentum, mouse-wheel, keyboard and touch support etc.
http://manos.malihu.gr/jquery-custom-content-scroller
MIT License
4.11k stars 1.51k forks source link

custom scroll bar issue with mobile devices #609

Open saibansal opened 6 years ago

saibansal commented 6 years ago

Hi

i am using this scroll bar but having problem with landscpe and portrat mode.

how can i set different height as per mobile device orientation

ThPadelis commented 6 years ago

First you need to check if user is in landscape or portrait mode. There are many options that you can achieve this. I used to use this code to detect user's orientation mode.

if(window.innerHeight > window.innerWidth){
    console.log('We are in portrait mode');
}else{
    console.log('We are in landscape mode');
}

Then you can simple set height for your container with JavaScript