jQuery Plugin – LightBox2
這篇文章也在馬老師舊的部落格出現過,不過既然搬家了就重新做一次吧!其實在馬老師雲端研究室裡面也大量應用了這樣的效果,無論你在這點選了圖片或Flash都會觸發這個效果,相信大家也看過很多次了,接下來我們就看看怎麼樣在自己的網頁中加入這樣的效果,首先大家可以先到LightBox2的官方網站下載他們打包好的jQuery和CSS…等資源,或按我直接下載。
下載後會有以下三個資料夾比較重要:
- CSS資料夾是放LightBox2所需要用到的CSS樣式表
- images資料夾是放LightBox2所需要用到的圖檔(例如上一張、下一張的按鈕)
- js資料夾是放LightBox2所需要用到的jQuery檔
接下來就可以開始製作網頁,在製作前也需要先準備一些大圖和小圖,如下圖例:
範例中檔名有s的表示縮圖(160×120)、另外就是大圖(640×480),在網頁裡面首先置入縮圖,在縮圖上製作超連結到大圖。
接下來就要開始針對語法做些處理了,在HTML中<head>…</head>區段加入以下的程式碼:
<script type="text/javascript" src="js/prototype.js"></script> <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script> <script type="text/javascript" src="js/lightbox.js"></script> <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
第1~3行是連結LightBox2中jQuery的程式,第4行則是連結LightBox2中CSS的樣式表,再來處理超連結的語法,在原本製作圖片超連結的部份加入rel=”lightbox[g1]”的語法,如下:
<a href="foods/location_pic_1.jpg" rel="lightbox[g1]"><img src="foods/location_pic_1_s.jpg" width="160" height="120" border="0" /></a> <a href="foods/location_pic_2.jpg" rel="lightbox[g1]"><img src="foods/location_pic_2_s.jpg" width="160" height="120" border="0" /></a> <a href="foods/location_pic_3.jpg" rel="lightbox[g1]"><img src="foods/location_pic_3_s.jpg" width="160" height="120" border="0" /></a>
其中g1的部份是表示這個圖片的群組,如果三張圖片都是g1則點選任一張,都可以在畫面中切換看到這三張,但若兩張圖片是g1第三張是g2的話,點選第一張圖片後只能切換到第二張,第三張則為獨立的圖檔,大家可以依照自己的情形修改括號內的文字,整體製作好的網頁語法如下:
<!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>LightBox2</title> <script type="text/javascript" src="js/prototype.js"></script> <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script> <script type="text/javascript" src="js/lightbox.js"></script> <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" /> </head> <body> <a href="foods/location_pic_1.jpg" rel="lightbox[g1]"><img src="foods/location_pic_1_s.jpg" width="160" height="120" border="0" /></a> <a href="foods/location_pic_2.jpg" rel="lightbox[g1]"><img src="foods/location_pic_2_s.jpg" width="160" height="120" border="0" /></a> <a href="foods/location_pic_3.jpg" rel="lightbox[g1]"><img src="foods/location_pic_3_s.jpg" width="160" height="120" border="0" /></a> </body> </html>
在這邊也提供整個製作完成的範例讓大家下載參考,或直接觀賞網頁檔,其實這個範例還有一些額外的小東西可以改,比如說彈出視窗的圖片標題,按鈕中文化…等,還要請大家再多多研究一下囉!希望這個範例對大家有所幫助,如果還有疑問,也可以在這邊回應唷~
It’s appropriate time tto make some pkans for thee longer term aand
itt is ime to be happy. I’ve leaarn this pput uup
and iif I mayy just I wish tto counsel yyou feew fascinating things or advice.
Mabe you can weite nnext artjcles referring to this article.
I waant tto rerad even more thimgs about it!
Профессиональный сервисный центр по ремонту холодильников и морозильных камер.
Мы предлагаем: мастера по ремонту холодильников
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
ремонт эппл вотч
プレミアムな機能を満載した豪華なドールをお探しでも、ラブドール エロ満足を提供する予算に優しい選択肢をお探しでも、ご安心ください。お客様のニーズはすべてカバーされています。
Your blog post was like a breath of fresh air. Thank you for reminding me to slow down and appreciate the beauty of life.
order voltaren for sale – buy aspirin online aspirin 75 mg price
Erten o, as the compartment for the half life runs swiftly to be ovulated first used to her buy priligy reddit
Since some garlic supplements contain little or no allicin, be sure to check the label for adequate allicin levels.
There are several ways to buy how long does it take neurontin to work are cheaper at online pharmacies
Symptoms must be present in the early developmental period but may not become fully manifest until social demands exceed limited capacities, or may be masked by learned strategies in later life.
Good advice If you have the slightest suspicion of any of the symptoms mentioned, you should contact your doctor at once for an assessment.
Give your wife the happiness she deserves. can you take keflex if allergic to penicillin through a mail order system is now very popular.
Only one parent has to carry the disease for a child to inherit the condition.
Initial laboratory studies showed leukopenia with a white blood cell count of 3 buy priligy Crestor Rosuvastatin
1999; 28 2 91- 122 PubMed Google Scholar cheap priligy Perls TT, Reisman NR, Olshansky SJ
Отличный сайт! Всем рекомендую!проститутки Питера
Proc Aust Assoc Neurol.
Embarrass no more. View this page buy nolvadex . Should I stop taking it?
PubMed Abstract Publisher Full Text totext Tweed DL.
Tetanus also called lockjaw is a disease caused by bacteria that attacks the nervous system that includes the brain, spinal cord and nerves.
When you need regular medication can you take cephalexin while pregnant at low prices always available through this specialist site
But again detox is horrible.
Hmm is anyone else experiencing problems with the images on this blog loading? I’m trying to find out if its a problem on my end or if it’s the blog. Any responses would be greatly appreciated.
https://metamorfeo.com/
Ziel HK, Finkle WD Increased risk of endometrial carcinoma among users of conjugated estrogens can i buy priligy in mexico
Отличный сайт! Всем рекомендую!проститутки СПб
ラブドール 販売In fact,I’m one of the converts! I was pretty skeptical of insect sentience at one point; I didn’t think that insects mattered.
Convert BTC to PayPal with ease and enjoy quick access to your funds.
Convert your Bitcoin to PayPal quickly and securely with our trusted exchange service.
Строительство, ремон своими руками. Советы мастеров и лучших специалстов в своем деле.
Каким вы видите свой будущий дом? Выполненный в духе уютного загородного шале или со сложными геометрическими формами и яркими элементами?
<a href=https://www.vuz-chursin.ru/stroitelstvo]Строительство
<a href=https://www.vuz-chursin.ru/stroymaterialy-0]Стройматериалы
<a href=https://www.vuz-chursin.ru/remont-i-otdelka]Отделка
Для большинства людей своя, пускай, даже крохотная, но отдельная однокомнатная квартира, намного слаще, чем аренда 5-комнтантного пентхауса за смешные деньги. Здесь можно устанавливать свои правила, планировать ремонт, делать перестановку, а единственное ограничение – это пространство.
Каталог полезных статей о стройке и ремонте <a href=https://vuz-chursin.ru/.
priligy buy There s not much fluffing to do with the rice, it s so sticky
buy priligy online safe Then it got so bad I could not wait anymore so I went, and they could not find my IUD so now I have been to the doc about 4times a Show More I had the IUD put in 6weeks after my little girl was born in 2009
Pink swayers, you need to go very lightly on any strategies such as tighty whiteys and hot baths and be willing to give them up if you do not get pg the first month or two can you buy priligy in usa
Отличный сайт! Всем рекомендую!проститутки
Your blog post was a real eye-opener for me. Thank you for challenging my preconceived notions and expanding my worldview.
1992, 267 19513 19520 dapoxetina comprar online
лучшие капперы лучшие капперы .
including emotional splitting,ラブドール エロdistorted object other relations,
order colospa 135mg generic – buy cheap cilostazol pletal drug