1

我想知道如何在页面转换发生后更改背景颜色。

例如,当我单击第一个链接并“弹出”到下一页时,它弹出到背景颜色的页面会发生变化。

第一页代码:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<h1>first page</h1>
<p>I am the first page!</p>
<a href="page1.html" data-transition="pop">page 1</a>
</body>
</html>

第二页代码:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
<style>
  .ui-page { background: #F00;}
</style>
</head>
<body>

    <h1>second</h1>
    <p>I am the second page!</p>
    <a href="../index.html" data-transition="slidefade">first page</a>
</body>
</html>

我在互联网上尝试了很多方法,但似乎没有任何效果,包括:

<style>
  .ui-page { background: #F00;}
</style>

如果我刷新第二页,这可以工作,但是当我单击第一页上的链接以转换到第二页然后更改背景颜色时,它不起作用...

4

0 回答 0