Icons not displaying with custom theme

断了今生、忘了曾经 提交于 2019-12-18 09:27:34

问题


I'm using jQuery mobile with a custom theme created on themeroller According to the instructions I have to include in the <head>:

<link rel="stylesheet" href="themes/mycustomtheme.min.css" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.0/jquery.mobile.structure-1.4.0.min.css" />
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.js"></script>

My custom theme displays perfectly but if I want to use an icon like:

<a href="#home" data-transition="slideup" data-role="button" data-icon="home">Home</a>

The "home" icon doesn't show. It only displays an empty circle.

I work with google chrome.

What should I include to resolve the issue?


回答1:


Note that data-role="button" is deprecated in 1.4 and will be removed from 1.5, now classes are added manually.

<a href="#page" class="ui-btn ui-btn-icon-left ui-icon-home">Anchor</a>

Moreover, jQM is now using SVG icons for platforms that support SVG and normal icons for ones that dont. Icons are added after an element using pseudo selector :after.

Creating custom icons is simple as the CSS below.

.ui-custom-icon:after {
  background-image: url('custom-icon.png');
  background-size: 25px 25px; /* dont forget this */
}

Now add .ui-custom-icon to any element.

Demo



来源:https://stackoverflow.com/questions/20858528/icons-not-displaying-with-custom-theme

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