我想要使用此代碼:http://jsfiddle.net/kFu52/1/我不知道如何整合此JQuery代碼
有人能告訴我我做錯了什麼嗎? 這是我想出了:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Demo</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link href="Untitled-3.css" rel="stylesheet" type="text/css" />
</head>
<body>
<script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.js"></script>
<script>
$('.thumbs img').hover(function() {
var url = $(this).attr('src');
$('#main').attr('src', url);
});
</script>
<div class="thumbs">
<img src="http://lorempixel.com/sports/200/400" width="50" height="50"/>
<img src="http://lorempixel.com/city/200/400" width="50" height="50"/>
<img src="http://lorempixel.com/people/200/400" width="50" height="50"/>
</div>
<div class="main-img">
<img id="main" src="http://lorempixel.com/people/200/400"/>
</div>
</body>
</html>
非常感謝,我顯然很新的JQuery的。
包內的文檔準備好你的代碼。 – Jai