Reputation: 171
I'm using Jquery Mobile Flat UI Theme. It's great but i want to add a separator between each listview .
Here is the listview :
Which code I have to add in my .css file ?
Upvotes: 2
Views: 2942
Reputation: 57309
Just add this li
element before every classic listview
element:
<li data-role="list-divider">Some text here</li>
Or it can be done automatically if you add an attribute data-autodividers="true"
to your listview ul
element.
<ul data-role="listview" data-autodividers="true" data-filter="true" data-inset="true">
<li><a href="index.html">Adam Kinkaid</a></li>
<li><a href="index.html">Alex Wickerham</a></li>
<li><a href="index.html">Avery Johnson</a></li>
<li><a href="index.html">Bob Cabot</a></li>
<li><a href="index.html">Caleb Booth</a></li>
<li><a href="index.html">Christopher Adams</a></li>
<li><a href="index.html">Culver James</a></li>
</ul>
Working example: http://jsfiddle.net/Gajotres/JHDsq/
$(document).on('pagecreate', '#index', function(){
$( "#mylistview li" ).each(function() {
$(this).before('<li data-role="list-divider"></li>');
});
});
This solution will add an divider to every existing li
element. Also take a notice at an attribute data-divider-theme="a"
, it will create black deviders.
Upvotes: 1
Reputation: 7380
If you want list style css to separate each list.
Check DEMO http://jsfiddle.net/2qgtA/1/
Add this css.
ul li.ui-li {
border-top:1px solid #ccc !important;
}
ul li.ui-li-divider{
border-top:none !important;
}
Upvotes: 3
Reputation: 2642
<ul data-role="listview">
<li>Acura</li>
<li>Audi</li>
<li>BMW</li>
</ul>
Upvotes: 0