jQuery Plugin – jQzoom

今天馬老師來介紹一個微星科技的網頁有利用到的技術 – jQzoom,大家可以先到微星的官網參考這個效果

微星科技 jQzoom範例

現在的網頁已經儘可能的把一些不需要使用Flash的地方,利用Javascript、CSS或HTML5的技術取代,這樣不斷可以減輕網頁的負載和流量,更可以達到SEO(搜尋引擎最佳化)的效果。

所以因應而生的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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQzoom Sample</title>

<script type="text/javascript" src="js/jquery-1.6.js"></script>
<script type="text/javascript" src="js/jquery.jqzoom-core.js"></script> 

<link rel="stylesheet" type="text/css" href="css/jquery.jqzoom.css">

<style type="text/css">
*{margin:0;padding:0;}/* 把HTML中所有邊界和填充歸零 */
#layout{margin-left:auto;margin-right:auto;width: 500px;}/* 定義主板面寬度和置中 */
#big {width: 500px; height:350px;}/* 定義大圖版面寬、高 */
#small {width: 500px; height:100px;}/* 定義小圖版面寬、高 */
ul#thumblist{display:block;}/* 定義超連結清單顯示方式 */
ul#thumblist li{float:left;margin-right:2px;list-style-image: none;list-style-type: none;}/* 定義清單項目浮動、間距、不顯示項目符號與圖片 */
ul#thumblist li a{display:block;border:1px solid #CCC;}/* 定義超連結項目顯示方式、邊框 */
ul#thumblist li a.zoomThumbActive{border:1px solid red;}/* 定義目前檢視項目邊框,套用在第一張縮圖上(本類別為js使用,更換名稱後會失去效果) */
.jqzoom{float:left;	text-decoration:none;}/* 套用在欲放大顯示的圖片連結上(本類別為js使用,更換名稱後會失去效果) */
</style>

<script type="text/javascript">
$(document).ready(function() {
	$('.jqzoom').jqzoom({zoomType: 'reverse',alwaysOn:false,zoomWidth:400,zoomHeight:324,showEffect:'fadein'});
});
/*
放大顯示照片效果設定共有以下選項可修改
zoomType:共有standard、reverse、drag、innerzoom四種效果(預設值standard)
zoomWidth:照片放大顯示區域寬(預設值300)
zoomHeight:照片放大顯示區域高(預設值300)
xOffset:放大顯示區域橫向位移(預設值10)
yOffset:放大顯示區域縱向位移(預設值0)
position:放大顯示區域位置,可以使用right,left,top,bottom這些設定(預設值right)
preloadImages:如果設定成true,會在網頁載入時會預先把所有大張的圖片都預先載入進來(預設值true)
preloadText:載入中顯示的文字(預設值:Loading zoom)
title:如果設定成true,會在放大顯示區域上方顯示圖片的title(預設值:true)
lens:如果設定成true,會在滑鼠移動時顯示放大區域範圍(預設值:true)
imageOpacity:設定圖像的不透明度,需將zoomType設定成reverse模式(預設值:0.4)
showEffect:設定放大區塊的淡入效果,共有show,fadein這兩個效果(預設值:show)
hideEffect:設定放大區塊的淡出效果,共有hide,fadeout這兩個效果(預設值:hide)
fadeinSpeed:設定淡入效果速度,可以使用fast,slow或輸入數值來控制(預設值:slow)
fadeoutSpeed:設定淡出效果速度,可以使用fast,slow或輸入數值來控制(預設值:2000)
*/

</script>

</head>

<body>

<div id="layout">

<div id="big">

<a class="jqzoom" href="images/big/msi_b1.jpg" title="微星筆記型電腦" rel='msi'><img src="images/small/msi_s1.jpg" width="400" height="320" title="微星筆記型電腦側面照" style="border: 3px solid #666;" /></a>

</div>

<div id="small">

<ul id="thumblist">
<li class="zoomThumbActive"><a href='javascript:void(0);' rel="{gallery: 'msi', smallimage: 'images/small/msi_s1.jpg',largeimage: 'images/big/msi_b1.jpg'}">
<img src="images/thumbnail/msi_t1.jpg" width="70" height="56" /></a></li>

<li><a href='javascript:void(0);' rel="{gallery: 'msi', smallimage: 'images/small/msi_s2.jpg',largeimage: 'images/big/msi_b2.jpg'}">
<img src="images/thumbnail/msi_t2.jpg" width="70" height="56" /></a></li>

<li><a href='javascript:void(0);' rel="{gallery: 'msi', smallimage: 'images/small/msi_s3.jpg',largeimage: 'images/big/msi_b3.jpg'}">
<img src="images/thumbnail/msi_t3.jpg" width="70" height="56" /></a></li>

<li><a href='javascript:void(0);' rel="{gallery: 'msi', smallimage: 'images/small/msi_s4.jpg',largeimage: 'images/big/msi_b4.jpg'}">
<img src="images/thumbnail/msi_t4.jpg" width="70" height="56" /></a></li>

<li><a href='javascript:void(0);' rel="{gallery: 'msi', smallimage: 'images/small/msi_s2.jpg',largeimage: 'images/big/msi_b5.jpg'}">
<img src="images/thumbnail/msi_t5.jpg" width="70" height="56" /></a></li>
</ul>
</div>

</div>

</body>
</html>

註:本範例所使用的圖片版權屬於微星科技公司所有。

You may also like...

3,547 Responses

  1. Hey very cool site!! Man .. Beautiful .. Amazing .. I will bookmark your website and take the feeds also…I’m happy to find so many useful information here in the post, we need develop more strategies in this regard, thanks for sharing. . . . . .

  2. Cthrinepisn表示:

    help writing essays for college
    legit essay writing services
    college application essay help online

  3. cooe apk表示:

    bonjour I love Your Blog can not say I come here often but im liking what i c so far….

  4. cooe表示:

    I had highly recommend this blog to my good friend, it’s so good

  5. Thanks for another great post. Where else may anybody get that type of info in such an ideal way of writing? I have a presentation next week, and I’m at the search for such information.

  6. A good web site with interesting content, that’s what I need. Thank you for making this web site, and I will be visiting again. Do you do newsletters? I Can’t find it.

  7. Leilahpisn表示:

    cheap custom essays
    scholarship essay writing help
    high school essay help

  8. Twylapisn表示:

    research essay help
    top 10 essay writing services
    extended essay help

  9. Dronapisn表示:

    i need help writing a essay
    essay writer online
    professional essay writers

  10. fantastic post, very informative. I wonder why more of the ther experts in the field do not break it down like this. You should continue your writing. I am confident, you have a great readers’ base already!

  11. click表示:

    Just want to say what a great blog you got here!I’ve been around for quite a lot of time, but finally decided to show my appreciation of your work!

  12. Hey, I simply hopped over to your website by way of StumbleUpon. No longer one thing I’d normally learn, but I preferred your thoughts none the less. Thanks for making one thing worth reading.

  13. Charopisn表示:

    reliable essay writing service
    best essay writer
    best rated essay writing service

  14. I concur with your conclusions and will eagerly look forward to your future updates. The usefulness and significance is overwhelming and has been invaluable to me!

  15. Rhiamonpisn表示:

    need help writing an essay
    buy essay paper
    essay writer funny

  16. DABAKAWLBIXoy表示:

    diovan 80 mg ca diovan 80 mg cost order generic diovan 80 mg

  17. DABAKAWLBIXbd表示:

    valsartan 80 mg uk diovan 160 mg without prescription valsartan 80 mg without prescription

  18. Antoniepisn表示:

    do essay writing services work
    macbeth essay help
    buy cheap essays online

  19. Tammiepisn表示:

    cheap essay writer
    online essay editing services
    help writing my college essay

  20. NABAKAWLBIXqr表示:

    purchase nebivolol pill bystolic generic order generic bystolic 5 mg

  21. NABAKAWLBIXxc表示:

    nebivolol 5 mg pills bystolic 10 mg for sale oral nebivolol

  22. Pennypisn表示:

    business school essay writing service
    your essay writer
    reviews for essay writing services

  23. I’ve read several good stuff here. Definitely worth bookmarking for revisiting. I surprise how much effort you put to make such a magnificent informative site.

  24. Chelsaepisn表示:

    help with scholarship essays
    admissions essay help
    college application essay services

  25. 야동공장表示:

    I came across an article that talks about the same thing but even more and when you go deeper.

  26. Nanicepisn表示:

    essayhelp
    college essay helper
    mba essay review service

  27. boslink.id表示:

    jasa backlink berkualitas

  28. BABAKAWLBIXna表示:

    nebivolol 5 mg sale buy bystolic 10 mg for sale bystolic 10 mg drug

  29. BABAKAWLBIXun表示:

    nebivolol 10 mg over the counter nebivolol online nebivolol 10 mg generic

  30. Charitapisn表示:

    buy an essay
    definition essay help
    cheap essays to buy

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。