兩層div
<body>
? ? ? ? <div id="divtest">
? ? ? ? ? ? <div class="title">
? ? ? ? ? ? ? ? <span class="fl">我的相冊(cè)</span>
? ? ? ? ? ? </div>
? ? ? ? ? ? <div class="content">
? ? ? ? ? ? ? ? <div class="divPics">
? ? ? ? ? ? ? ? ? ? <ul>
? ? ? ? ? ? ? ? ? ? ? ? <li><a title="第1篇風(fēng)景圖片">
? ? ? ? ? ? ? ? ? ? ? ? ? ? <img src="http://img1.sycdn.imooc.com//52e489f20001ecfc04480275.jpg" alt="" />
? ? ? ? ? ? ? ? ? ? ? ? </a></li>
? ? ? ? ? ? ? ? ? ? ? ? <li><a title="第2篇風(fēng)景圖片">
? ? ? ? ? ? ? ? ? ? ? ? ? ? <img src="http://img1.sycdn.imooc.com//52e48a1e0001eec804480275.jpg" alt="" />
? ? ? ? ? ? ? ? ? ? ? ? </a></li>
? ? ? ? ? ? ? ? ? ? ? ? <li><a title="第3篇風(fēng)景圖片">
? ? ? ? ? ? ? ? ? ? ? ? ? ? <img src="http://img1.sycdn.imooc.com//52e48a4c00015ad204480275.jpg" alt="" />
? ? ? ? ? ? ? ? ? ? ? ? </a></li>
? ? ? ? ? ? ? ? ? ? </ul>
? ? ? ? ? ? ? ? </div>
? ? ? ? ? ? </div>
? ? ? ? </div>
? ? ? ??
? ? ? ? <script type="text/javascript">
? ? ? ? ? ? $(function () {
? ? ? ? ? ? ? ? $(".divPics a").lightBox(
? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? overlayBgColor: "#666", //圖片瀏覽時(shí)的背景色
? ? ? ? ? ? ? ? ? ? overlayOpacity: 0.5, //背景色的透明度
? ? ? ? ? ? ? ? ? ? containerResizeSpeed: 600 //圖片切換時(shí)的速度
? ? ? ? ? ? ? ? })
? ? ? ? ? ? });
? ? ? ? </script>
? ? </body>
為什么要加content,divPics兩層div?分別是哪兩個(gè)?
2017-04-12
加不加content這個(gè)div我覺(jué)得其實(shí)都沒(méi)有關(guān)系,加了的話,代碼更好看點(diǎn),divPics這個(gè)才是燈箱放圖片的地方。點(diǎn)擊之后出來(lái)的隔離層燈箱效果,是jQuery封裝好的代碼里面通過(guò)操作DOM增加出來(lái)的,和 content跟divPics沒(méi)有關(guān)系。