0
所以基本上這對w3School工作,但不是在我的生活環境。下面是代碼:.fade不要在我的代碼上工作,但可以在w3School上使用相同的代碼正常工作。爲什麼?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Vecta Corp. Mobile</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script>
$(document).ready(function(){
$("#5").click(function(){
$("#yourview").fadeTo(1000, 0.05);
});
});
</script>
</head>
<body>
<section data-role="content">
<h2>Dr. Tint SolarPill Tint</h2>
<h3>See how SolarPill looks from inside your tinted car</h3>
<p><img alt="" src="images/tintshade.png" id="yourview" style="width:347px;"></p>
<p style="width:350px;">
<input id="5" value="5%" style="font-size:12px;width: 36px;margin-left: 18px;" type="button">
</p>
</section>
</div>
</body>
</html>
這裏是:w3school link和將此代碼粘貼到它,並嘗試自己:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#5").click(function(){
$("#yourview").fadeTo(1000, 0.4);
});
});
</script>
</head>
<body>
<p><img alt="" src="http://www.mobile-tinting.com/img.png" id="yourview" style="width:347px;"></p>
<input id="5" value="5%" style="font-size:12px;width: 36px;margin-left: 18px;" type="button">
</body>
</html>
難道這與jQuery Mobile的衝突,因爲這是字面上的唯一區別這兩個代碼。或者我在這裏做錯了什麼?
您的開發者控制檯告訴您什麼?順便說一句,嘗試一個更好的教程網站。 – Raptor
適用於我..檢查您的瀏覽器'控制檯.. .. –
我檢查了我的控制檯,它顯示了很好,但由於一些奇怪的原因,它只是不起作用。我的代碼對你們工作正常嗎? –