Icon only back button jQuery Mobile

2019-08-19 07:49发布

Within my jQuery Mobile page I programmatically set up my back button to appear on every page that is not the first page by using the following code <div data-role="page" data-add-back-btn="true" id="anid"> what this does is create a back button that have text in it saying back. however I do not want that I want the icon only.

How can this be done in jQuery Mobile

3条回答
Fickle 薄情
2楼-- · 2019-08-19 08:23

for me this one worked:

data-iconpos="notext"

Example:

<a href="#" data-icon="back" data-rel="back" title="Regresar" data-iconpos="notext"></a>
查看更多
太酷不给撩
3楼-- · 2019-08-19 08:25

You can do this.

$(document).on('pagebeforeshow', function () {
 $(this).find('a[data-rel=back]').buttonMarkup({iconpos: 'notext'});
});

Demo

查看更多
地球回转人心会变
4楼-- · 2019-08-19 08:32

Working example: http://jsfiddle.net/Gajotres/ygmWD/

$(document).on('pagebeforeshow', function () {
    $.mobile.activePage.find(".ui-header a.ui-btn-left").addClass("ui-btn-icon-notext");
    $.mobile.activePage.find(".ui-header a.ui-btn-left").removeClass("ui-btn-icon-left");
});
查看更多
登录 后发表回答