cubiq / iscroll

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

Multi-use is awkward with static selectors for wrapper and scroller #660

Open robvon opened 10 years ago

robvon commented 10 years ago

Consider changing the css to work with class selectors not id selectors. Then you can have multiple instances on a page.

It seems to work ok - just 'wrapper' and 'scroller' really.

robvon commented 10 years ago

Consider changing the css to work with class selectors not id selectors. Then you can have multiple instances on a page.

It seems to work ok - just 'wrapper' and 'scroller' really.

skbohrer commented 10 years ago

Maybe I'm missing the gist of your question, but the option is totally yours what sort of thing you pass in. You can either find the object yourself and pass that, or else pass a selector string, e.g. '#yourScrollID' or '.yourScrollClass' . Totally up to you.

However, for multiple scrolls, you do need cycle through them all yourself; when you pass a class, ISroll picks the first one. Makes more sense for the for loop to be in your code than in the library using space for every use of the library.

Wait a sec: Have you read the docs? I assume that you you would have before posting...

Cheers, Steve

robvon commented 10 years ago

Yup printed and read the docs.

Fully implemented a multi-scroll with 12 iScrolls. Enjoy the touch and mouse interaction. Works just fine with an API wrapping it to show initial values and report current positions

Added my own buttons for left and right nav to support desktop

Converted the css to LESS so I can size for colours, height and width with one change

Had to change the css selectors though BECAUSE IT REFERENCES FIXED ID’s which only work if there is only one. Hence my post.

This may be a feature of you demos only ?

R

From: skbohrer [mailto:notifications@github.com] Sent: Saturday, 29 March 2014 8:16 AM To: cubiq/iscroll Cc: Rob von Nesselrode Subject: Re: [iscroll] Multi-use is awkward with static selectors for wrapper and scroller (#660)

Maybe I'm missing the gist of your question, but the option is totally yours what sort of thing you pass in. You can either find the object yourself and pass that, or else pass a selector string, e.g. '#yourScrollID' or '.yourScrollClass' . Totally up to you.

However, for multiple scrolls, you do need cycle through them all yourself; when you pass a class, ISroll picks the first one. Makes more sense for the for loop to be in your code than in the library using space for every use of the library.

Wait a sec: Have you read the docs? I assume that you you would have before posting...

Cheers, Steve

— Reply to this email directly or view it on GitHub https://github.com/cubiq/iscroll/issues/660#issuecomment-38974045 . https://github.com/notifications/beacon/1008967__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxMTY2NDE2NywiZGF0YSI6eyJpZCI6Mjg3Mzc5ODR9fQ==--9048a325909050483648219df1e1f8b0f0caec79.gif

skbohrer commented 10 years ago

Sorry, I guess I was missing the gist of you question! Your follow up makes it more clear what you are looking for.

robvon commented 10 years ago

Thanks,

Anyway, I’m not looking for anything much as it was a simple change. I just wanted to point it out to you.

That way you could change your css in the demos to use class selectors not id selectors

Regards

Rob

From: skbohrer [mailto:notifications@github.com] Sent: Sunday, 30 March 2014 3:34 AM To: cubiq/iscroll Cc: Rob von Nesselrode Subject: Re: [iscroll] Multi-use is awkward with static selectors for wrapper and scroller (#660)

Sorry, I guess I was missing the gist of you question! Your follow up makes it more clear what you are looking for.

— Reply to this email directly or view it on GitHub https://github.com/cubiq/iscroll/issues/660#issuecomment-39002578 . https://github.com/notifications/beacon/1008967__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxMTczMzYyMywiZGF0YSI6eyJpZCI6Mjg3Mzc5ODR9fQ==--98802e1c8ef9f898d2bcf382f1f1f77b864f2cb4.gif