【发布时间】:2014-05-16 01:11:21
【问题描述】:
在我正在创建的网站中,我使用 jQuery Mobile,但我对此并不了解,而且我遇到了一个大问题。在我的网站中,我只在一个页面上链接到 jQuery Mobile,我只想在一个页面上使用 jQuery Mobile(我不知道这是否可能,但这就是我想要做的)。
我的网站上有四个主要页面:Homepage.php、SalesForms.php、Reports.php 和 Login.php。我只想在 Reports.php 页面上使用 jQuery Mobile(我使用它来进行转换以创建一个漂亮的 html 表单流程)。
每当我访问 Reports.php 页面时,它都会使用 jQuery Mobile 和 jQuery 以及 jQuery Mobile CSS,这很好。但是当我离开 Reports.php 页面并转到其他页面时,jQuery Mobile 及其 CSS 仍在使用中,即使它没有链接到那些页面上并且我不想使用它。
例如,当我访问 Homepage.php 时,它没有使用 jQuery Mobile 或其 CSS,然后我访问 Reports.php,它确实使用了 jQuery Mobile 及其 CSS,然后我再次访问 Homepage.php,它仍然是使用 jQuery Mobile 及其 CSS。这对我来说是个问题,因为 jQuery Mobile 的 CSS 在 Reports.php 页面以外的页面上干扰了我的 CSS,Reports.php 页面是它唯一链接到的页面。
我想知道是否以及如何使 jQuery Mobile 仅在 Reports.php 页面上使用,这样如果我在访问 Reports.php 页面后转到另一个页面,它就不会使用 jQuery Mobile。
这是我链接到 jQuery Mobile 的代码(我只在 Reports.php 页面中链接到 jQuery Mobile):
<head>
<link rel="stylesheet" href="../css/jQuery.css">
<link rel="stylesheet" href="../css/Main.css">
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
</head>
jQuery.css 只是 jQuery 的 CSS 的修改版本,因此它不会干扰我的 CSS,而 Main.css 是我的 CSS。
【问题讨论】:
标签: jquery jquery-mobile webpage