jQuery Mobile后退按钮中的图像未出现 [英] Image in jQuery Mobile back button doesn't appear
问题描述
我已按照jQueryMobile文档的说明将jQueryMobile插件设置到我的博客移动版本中.
I've set-up jQueryMobile plugin into my blog mobile version by the instruction of jQueryMobile documentation.
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.css" />
<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"></script>
,说明页面如下
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Against All Odds</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.css" />
<link rel="stylesheet" href="_assets/css/jqm-docs.css"/>
<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>my title</h1>
</div><!-- /header -->
<div data-role="content">
my description
</div><!-- /content -->
</div><!-- /page -->
</body>
</html>
很遗憾,后退按钮中的图像没有出现在我的页面中.而且我还将jQuerymobile图片文件夹放入了我的项目页面.我忘了设置任何配置吗?
Unfortunately, the image in back button doesn't appear in my page. And I've also put jQuerymobile images folder into my project page. Is there any configuration did I forget to setup?
推荐答案
我昨天正在查看此代码,但没有查看 jquery-mobile 页并获得主分支 download.zip .
I was looking through this code yesterday, but instead of looking at the Alpha 2 release (from Nov 12, 2010), I went out to the jquery-mobile page on GitHub and got the master branch download.zip.
下面的代码是将后退按钮添加到标题并自动将data-icon
设置为arrow-l
的功能.我也忘记了将图像目录放在我的项目中.
The code below is what adds the back button to the header and auto sets the data-icon
to arrow-l
. I had also forgot to put the images directory in my project.
// auto-add back btn on pages beyond first view
if ( o.addBackBtn && role === "header" &&
($.mobile.urlHistory.getPrev() || $(".ui-page").length > 1) &&
!leftbtn && $this.data( "backbtn" ) !== false ) {
$( "<a href='#' class='ui-btn-left' data-icon='arrow-l'>"+ o.backBtnText +"</a>" )
.click(function() {
history.back();
return false;
})
.prependTo( $this );
}
我还需要包含这些js和css文件,这些文件是从下载文件中复制到项目的根目录中的.
I also needed to include these js and css files, which I copied from the download into the root directory of my project.
<link rel="stylesheet" href="jquery.mobile.css" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.mobile.js"></script>
这篇关于jQuery Mobile后退按钮中的图像未出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!