私は狂っています...スクリプトにエラーがありますが、私はそれを見つけられず、奇妙な、またエクスプローラのデバッグが見つかりません!デバッグでエラーが見つかりません...奇妙な
私はエクササイズでそれをたくさん試しましたが、私はそれを見つけることができません。あなたは、構文エラーを持っている
<script src="../_js/jquery.min.js"></script>
<script>
$(document).ready(function() {
\t \t
$('#gallery img').each(function(i) {
\t var imgFile = $(this).attr('src');
\t var preloadImage = new Image();
\t var imgExt = /(\.\w{3,4}$)/;
\t preloadImage.src = imgFile.replace(imgExt,'_h$1');
\t \t
\t $(this).hover(
\t \t function() {
\t \t \t $(this).attr('src', preloadImage.src);
\t \t },
\t \t function() {
\t \t var currentSource=$(this).attr('src');
\t \t \t $(this).attr('src', imgFile);
\t }); // end hover
}); // end each
\t
$('#gallery a').click(function(evt){
\t evt.preventDefault();
\t var imgPath = $(this).attr('href');
var oldImage = $('#photo img');
var newImage = $('<img src"' + imgPath +'">');
newImage.hide();
$('#photo').prepend(newImage);
newImage.fadeIn(1000);
oldImage.fadeOut(1000,function(){
\t $(this).remove();
}); //end fadeout
});// end click
$('#gallery a:first').click();
}); // end ready
</script>
<style>
#gallery {
\t float: left;
\t width: 90px;
\t margin-right: 30px;
\t margin-left: 10px;
\t border-right: white 1px dotted;
}
#gallery img {
\t display: inline-block;
\t margin: 0 0 10px 0;
\t border: 1px solid rgb(0,0,0);
}
#photo {
\t margin-left: 150px;
\t position: relative;
}
#photo img {
\t position: absolute;
}
</style>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Rollover Images</title>
<link href="../_css/site.css" rel="stylesheet">
</head>
<body>
<div class="wrapper">
\t <header>
JAVASCRIPT <span class="amp">&</span> jQUERY: THE MISSING MANUAL
\t </header>
\t <div class="content">
\t \t <div class="main">
\t \t \t <h1>Slideshow</h1>
\t \t \t <div id="gallery"> <a href="../_images/large/slide1.jpg"><img src="../_images/small/slide1.jpg" width="70" height="70" alt="golf balls"></a> <a href="../_images/large/slide2.jpg"><img src="../_images/small/slide2.jpg" width="70" height="70" alt="rock wall"></a> <a href="../_images/large/slide3.jpg"><img src="../_images/small/slide3.jpg" width="70" height="70" alt="old course"></a> <a href="../_images/large/slide4.jpg"><img src="../_images/small/slide4.jpg" width="70" height="70" alt="tees"></a> <a href="../_images/large/slide5.jpg"><img src="../_images/small/slide5.jpg" width="70" height="70" alt="tree"></a> <a href="../_images/large/slide6.jpg"><img src="../_images/small/slide6.jpg" width="70" height="70" alt="ocean course"></a></div>
\t \t \t <div id="photo"></div>
\t \t </div>
\t </div>
\t <footer>
<p>JavaScript & jQuery: The Missing Manual, 3rd Edition, by <a href="http://sawmac.com/">David McFarland</a>. Published by <a href="http://oreilly.com/">O'Reilly Media, Inc</a>.</p>
\t </footer>
</div>
</body>
</html>
を=を逃したあなたのコード –
をフォーマットしてください私は ''「キャッチされないでSyntaxError:予期しないトークン}」それを実行すると、私はエラーメッセージを見ることができるが、少しのでかもしれないが ' – Orangesandlemons
、のコードがありません。 – Orangesandlemons