最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jQuery Mobile list divider using the wrong swatch? - Stack Overflow

programmeradmin1浏览0评论

I've used the jQuery Mobile ThemeRoller to create a theme for a new mobile website I'm working on. In general the theme works well, but the list-divider that's displayed in the ThemeRoller isn't used in my application.

Here's a screenshot illustrating the problem:

ThemeRoller problem .png

The relevant HTML for the page in question is:

<div id="schedule" data-role="page" data-theme="a">
    <div data-role="content" data-theme="a">
        <ul data-role="listview">
            <li data-role="list-divider">8:00 am</li>
            <li><a href="#session">Wele &amp; Keynote</a></li>
            <li data-role="list-divider">9:00 am</li>
            <li><a href="#session">Session title displayed here</a></li>
        </ul>
    </div>
</div>

I've even tried adding a few things I found in the ThemeRoller markup:

<li data-role="list-divider" data-swatch="a" class="ui-bar-a" data-form="ui-bar-a">8:00 am</li>

This has no effect. No matter what I do, it seems to set the class to ui-bar-b. I can live-edit the HTML in Chrome and change ui-bar-b to ui-bar-a and it looks exactly how I would expect.

Am I doing something wrong? Is this maybe a jqm bug?

Using jqm 1.1.0 and jquery 1.7.0.

I've used the jQuery Mobile ThemeRoller to create a theme for a new mobile website I'm working on. In general the theme works well, but the list-divider that's displayed in the ThemeRoller isn't used in my application.

Here's a screenshot illustrating the problem:

ThemeRoller problem http://img.skitch./20120416-8fbfbu41abrci1ym8uthatfi4e.png

The relevant HTML for the page in question is:

<div id="schedule" data-role="page" data-theme="a">
    <div data-role="content" data-theme="a">
        <ul data-role="listview">
            <li data-role="list-divider">8:00 am</li>
            <li><a href="#session">Wele &amp; Keynote</a></li>
            <li data-role="list-divider">9:00 am</li>
            <li><a href="#session">Session title displayed here</a></li>
        </ul>
    </div>
</div>

I've even tried adding a few things I found in the ThemeRoller markup:

<li data-role="list-divider" data-swatch="a" class="ui-bar-a" data-form="ui-bar-a">8:00 am</li>

This has no effect. No matter what I do, it seems to set the class to ui-bar-b. I can live-edit the HTML in Chrome and change ui-bar-b to ui-bar-a and it looks exactly how I would expect.

Am I doing something wrong? Is this maybe a jqm bug?

Using jqm 1.1.0 and jquery 1.7.0.

Share Improve this question edited Apr 16, 2012 at 17:32 Jasper 76k14 gold badges152 silver badges148 bronze badges asked Apr 16, 2012 at 16:34 Adam TuttleAdam Tuttle 19.8k17 gold badges83 silver badges116 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

You can add the data-dividertheme="a" attribute to your data-role="listview" element to force a specific swatch to be used for the divider list-items. By default, if your listview is set to theme a, then the dividers will be set to theme b, so you have to force list-dividers to be the correct theme or you have to build your themes with this in mind.

    <ul data-role="listview" data-dividertheme="a">
        <li data-role="list-divider">8:00 am</li>
        <li><a href="#session">Wele &amp; Keynote</a></li>
        <li data-role="list-divider">9:00 am</li>
        <li><a href="#session">Session title displayed here</a></li>
    </ul>

Here is a demo: http://jsfiddle/8aZpQ/ (this demo forces theme e for dividers)

And here is the documentation for this: http://jquerymobile./demos/1.1.0/docs/lists/docs-lists.html

发布评论

评论列表(0)

  1. 暂无评论