cubiq / iscroll

Smooth scrolling for the web
http://iscrolljs.com
MIT License
12.87k stars 3.8k forks source link

iScroll doesn't work #1149

Open foria opened 7 years ago

foria commented 7 years ago

I can't understand why iScroll doesn't work for my mobile navigation. I put an event on scroll to check what it can be and I got this error: Uncaught TypeError: Cannot read property 'apply' of undefined

Can you help me to understand the issue please? Thx

My HTML is:`

t0ny-peng commented 7 years ago

Maybe you can build a test demo on jsfiddle then we can find where the problem is.

foria commented 7 years ago

I discovered the problem. I'm using iScroll to get mobile menu scroll when it's larger then device height. My menu has 2 levels, if the 1st level is larger then device height everything works fine even on the 2nd level. The problem is if the 1st level fit totally in the device height and iScroll seems not being activated. This because my 2nd level menus are in absolute position, so they overflow the menu container on which I init iScroll. I found a workaround setting the largest height among submenus as 1st level menu height in case this is larger. Thx.