How to make jQuery Mobile list dividers fixed at top

旧时模样 提交于 2019-12-24 11:04:14

问题


Is there a way to make the "data-role="list-divider" fixed at the top of the page until the next letter or list divider comes up and takes its place, like in the iPhone contact app?

Here is a link to the jquery mobie list dividers demo. The list dividers dont stay at the top but rather scroll up and down with the page.

http://jquerymobile.com/demos/1.0a3/#docs/lists/lists-divider.html

Thanks for your help in advance.

-bob


回答1:


Check this out.Not sure what exactly to do.

http://jquerymobile.com/test/experiments/scrollview/lists-divider.html




回答2:


There's a great plugin which does exactly this, and gives you custom events etc. The project is available on GitHub and there's also a showcase article about it.

The plugin allows you to use any selector to define which elements are headers, so your case will look (something) like this:

$('ul').list({ headerSelector : '[data-role="list-divider"]' });

Although, you're probably better off to use a class, or element selector for best performance :-)



来源:https://stackoverflow.com/questions/7814088/how-to-make-jquery-mobile-list-dividers-fixed-at-top

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!