0

根据“ http://jquerymobile.com/demos/1.2.1/docs/buttons/buttons-icons.html ”,我正在尝试让一个按钮与数据图标一起使用,这应该是编写以下代码...

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
   <link href="Content/jquery.mobile-1.3.0.min.css" rel="stylesheet" type="text/css" />
   <a data-role="button" href="#page1" data-icon="arrow-u" data-iconpos="left">
        Button
    </a>
</body>
</html>

但是,当我在本地构建它并部署在服务器上时,它不会显示图标。有人可以帮忙吗?

4

4 回答 4

3

您的标记应如下所示。

<head>
 <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
 <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
 <script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
</head>

然后是 jQuery Mobile 代码

<div data-role='page'>
 <a href='#' data-role='button' data-icon='arrow-u' data-iconpos='left'>Button</a>
</div>

参考:

于 2013-06-05T13:23:30.243 回答
0

将您的链接标签移动到头部。并根据您指向 css 文件的链接,

You must also include JQM's images folder under your "Content/" folder.

您的 html 代码必须如下所示,

<!DOCTYPE html> 
<html>
<head>
    <title>Page Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
</head>

<body>
    ...content goes here...
</body>
</html>
于 2013-06-06T02:43:36.837 回答
0

看到这个jsbin

您需要将 <link> 标签放在 head 内容中,并且您可能还需要添加一些其他(以下)脚本。

<link href="http://code.jquery.com/mobile/latest/jquery.mobile.css" rel="stylesheet" type="text/css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/latest/jquery.mobile.js"></script>
于 2013-06-05T13:23:46.433 回答
0

您的样式表需要在头部链接。

<head>
   <title></title>
   <link href="Content/jquery.mobile-1.3.0.min.css" rel="stylesheet" type="text/css" />
</head>
<body>
   <a data-role="button" href="#page1" data-icon="arrow-u" data-iconpos="left">
    Button
   </a>
</body>
于 2013-06-05T13:23:47.563 回答