This repository was archived by the owner on Oct 8, 2021. It is now read-only.
This repository was archived by the owner on Oct 8, 2021. It is now read-only.
Turn off listview icons by default so no need to use data-icon="false" everywhere and override where necessary #4570
Closed
Description
JQM 1.1.0 FINAL
I did not want icons on my listview elements except where explicitly defined - basically turning the default behaviour on its head:
- Add this before the jquery.mobile.js is loaded.
<script>
$(document).bind("mobileinit", function(){
$.mobile.listview.prototype.options.icon = false;
});
</script>
- NEED TO EDIT THE CORE JQUERY MOBILE FUNCTION FOR THIS TO WORK:
Within
if ( a.length ) {
icon = item.jqmData("icon");
This obviously takes no notice of the "options.icon" flag set in step (1) for the list view and will show an icon for all
if ( a.length ) {
var override = item.jqmData("icon");
icon = (override !== undefined) ? override : (o.icon !== undefined) ? o.icon : override;
- Wherever you want an icon just use the data-icon directive as normal e.g.
<ul data-role="listview" data-inset="true">
<li data-icon="star" ><a href="#">Icon</a></li>
<li><a href="#">No Icon</a></li
</ul>
So now you can remove all those <li data-icon="false">
statements and use <li>
instead. I don't think there are any regressions with this update, behaviour will be as current 1.1.0 if the listview option.icon flag is left undefined.