2013-11-24 31 views
0

不完全確定我在這裏做了什麼錯誤,但出於某種原因,我無法獲取此jQuery框中列出的.click()事件的工作。因爲這是我第一次嘗試使用jQuery,我假設它可能是我沒有考慮過的一個小細微差別,或者我看過的細節。任何幫助,這將不勝感激。無法讓jQuery事件起作用

<html> 
    <style> 
    #thumbs { padding-top: 10px; overflow: hidden; } 

    #thumbs img, #largeImage { 
     border: 1px solid gray; 
     padding: 4px; 
     background-color: white; 
     cursor: pointer; 
    } 

    .thumbnail { 
     float: left; 
     margin-right: 6px; 
     height: 60%; 
     width: 60%; 
    } 

    #description { 
     background: black; 
     color: white; 
     position: absolute; 
     bottom: 0; 
     padding: 10px 20px; 
     width: 525px; 
     margin: 5px; 
    } 

    #panel { position: relative; } 

    </style> 

    <head> 
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" > 
     $('.thumbnail').click(function(){ 
     $('#largeImage').attr('src',$(this).attr('src').replace('thumb','large')); 
     $('#description').html($(this).attr('alt')); 
     }); 
    </script> 
    </head> 

    <body> 
    <div id="gallery"> 
     <div id="panel"> 
     <img id="largeImage" src="C:\wamp\www\HoneysProject\Image2.jpg" /> 
     <div id="description">First image description</div> 
     </div> 

     <div id="thumbs"> 
     <img class="thumbnail" src="C:\wamp\www\HoneysProject\Image2.jpg" alt="1st image  description" /> 
     <img class="thumbnail" src="C:\wamp\www\HoneysProject\Image3.jpg" alt="2nd image description" /> 
     <img class="thumbnail" src="C:\wamp\www\HoneysProject\Image4.jpg" alt="3rd image description" /> 
     <img class="thumbnail" src="C:\wamp\www\HoneysProject\Image6.jpg" alt="4th image description" /> 
     </div> 
    </div> 
    </body> 
</html> 
+0

旁白:XHTML的DOCTYPE沒有配發'