Trình chiếu nội dung và hình ảnh sử dụng Mootools
Thứ Sáu, 17 tháng 12, 2010
Trang playrecords.net được tạo trên nền Wordpress nên kiểu slideshow rất phức tạp. Sau khi nghiên cứu, tôi đã tích hợp nó thành một gói slideshow tương thích cho blogspot và có một số điều chỉnh như tạo thêm phần tiêu đề và tóm tắt cho từng slide ảnh để người đọc có thể nắm bắt thông tin cơ bản về slide ảnh. Slideshow này có sự hỗ trợ của thư viện Mootools giúp cho kiểu trình chiếu nội dung và hình ảnh mượt mà hơn.
Xem Demo.
Để cài đặt tiện ích này, bạn hãy thực hiện theo các bước sau đây.
Bước 1. Đăng nhập Blogger vào Design >> Edit HTML và đặt đoạn code dưới đây vào trước thẻ </head>.
<style type="text/css">
#myGallery,#myGallerySet{width:560px;height:200px;z-index:5;margin-bottom:20px;margin-top:15px;overflow-y:hidden;}
.jdGallery a{outline:0}
#myGallery img.thumbnail,#myGallerySet img.thumbnail{display:none}
.jdGallery{overflow:hidden;position:relative}
.jdGallery img{border:0;margin:0}
.jdGallery .slideElement{width:100%;height:100%;background-color:#000;background-repeat:no-repeat;background-position:center center;background-image:url('https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdtJseqT_xIMCH-4BkbD8jW7QUgEimIjRVBKnuij1Bji9g-C5IqbC_fJ3W9tIIvQtKYLJEZuvixrSWoyDe4SA9dqd77MutEX_UtOTUfpULOLcjWmaj85MgpTAwU6rT05y4w9L1kIPUsO8/s0/loading-bar-black.png')}
.jdGallery .loadingElement{width:100%;height:100%;position:absolute;left:0;top:0;background-color:#000;background-repeat:no-repeat;background-position:center center;background-image:url('https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdtJseqT_xIMCH-4BkbD8jW7QUgEimIjRVBKnuij1Bji9g-C5IqbC_fJ3W9tIIvQtKYLJEZuvixrSWoyDe4SA9dqd77MutEX_UtOTUfpULOLcjWmaj85MgpTAwU6rT05y4w9L1kIPUsO8/s0/loading-bar-black.png')}
.jdGallery .slideInfoZone{position:absolute;z-index:10;width:100%;margin:0;left:0;bottom:0;height:50px;background:#343433;color:#fff;text-indent:0;overflow:hidden}
* html .jdGallery .slideInfoZone{bottom:-1px}
.jdGallery .slideInfoZone h2{padding:0;margin:0;margin:2px 5px;font-size:14px;font-weight:bold;color:#fff !important}
.jdGallery .slideInfoZone p{padding:0;font-size:12px;margin:2px 5px;color:#eee}
.jdGallery div.carouselContainer{position:absolute;height:135px;width:100%;z-index:10;margin:0;left:0;top:0}
.jdGallery a.carouselBtn{position:absolute;bottom:0;right:30px;height:20px;/*width:100px;background:url('img/carousel_btn.gif') no-repeat;*/
text-align:center;padding:0 10px;font-size:13px;background:#333;color:#fff;cursor:pointer}
.jdGallery .carousel{position:absolute;width:100%;margin:0;left:0;top:0;height:80px;background:#333;color:#fff;text-indent:0;overflow:hidden}
.jdExtCarousel{overflow:hidden;position:relative}
.jdGallery .carousel .carouselWrapper,.jdExtCarousel .carouselWrapper{position:absolute;width:100%;height:78px;top:10px;left:0;overflow:hidden}
.jdGallery .carousel .carouselInner,.jdExtCarousel .carouselInner{position:relative}
.jdGallery .carousel .carouselInner .thumbnail,.jdExtCarousel .carouselInner .thumbnail{cursor:pointer;background:#000;background-position:center center;float:left;border:solid 1px #fff}
.jdGallery .wall .thumbnail,.jdExtCarousel .wall .thumbnail{margin-bottom:10px}
.jdGallery .carousel .label,.jdExtCarousel .label{font-size:13px;position:absolute;bottom:5px;left:10px;padding:0;margin:0}
.jdGallery .carousel .wallButton,.jdExtCarousel .wallButton{font-size:10px;position:absolute;bottom:5px;right:10px;padding:1px 2px;margin:0;background:#222;border:1px solid #888;cursor:pointer}
.jdGallery .carousel .label .number,.jdExtCarousel .label .number{color:#b5b5b5}
.jdGallery a{font-size:100%;text-decoration:none;color:#fff}
.jdGallery a.right,.jdGallery a.left{position:absolute;height:99%;width:25%;cursor:pointer;z-index:10;filter:alpha(opacity=20);-moz-opacity:0.2;-khtml-opacity:0.2;opacity:0.2}
* html .jdGallery a.right,* html .jdGallery a.left{filter:alpha(opacity=50)}
.jdGallery a.right:hover,.jdGallery a.left:hover{filter:alpha(opacity=80);-moz-opacity:0.8;-khtml-opacity:0.8;opacity:0.8}
.jdGallery a.left{left:0;top:0;background:url('http://www.playrecords.net/wp-content/plugins/featured-content-gallery/css/img/fleche1.png') no-repeat center left}
* html .jdGallery a.left{background:url('http://www.playrecords.net/wp-content/plugins/featured-content-gallery/css/img/fleche1.png') no-repeat center left}
.jdGallery a.right{right:0;top:0;background:url('http://www.playrecords.net/wp-content/plugins/featured-content-gallery/css/img/fleche2.png') no-repeat center right}
* html .jdGallery a.right{background:url('http://www.playrecords.net/wp-content/plugins/featured-content-gallery/css/img/fleche2.png') no-repeat center right}
.jdGallery a.open{left:0;top:0;width:100%;height:100%}
.withArrows a.open{position:absolute;top:0;left:25%;height:99%;width:50%;cursor:pointer;z-index:10;background:none;-moz-opacity:0.8;-khtml-opacity:0.8;opacity:0.8}
.withArrows a.open:hover{background:url('https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtlISYhIsA2MFTtjxmDu4vi8p-38rOgroYGZqjODZIL4tN7afEaFJRrtnrgecXq3ofKqJeUD2YBX12ajEyXPzFJS5-9oFwSl0xrr7IswPjnHw-AxiBze_uY0K6LNioN44al5bq2Rihg0U/s0/open.png') no-repeat center center}
* html .withArrows a.open:hover{background:url('https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi87ino3yvJPbe4SLAhuvjcHdLSx0yHbiNWhzFiFUXnqOrPv6buc6-yGpaqT7sP77og0N4g5MNvvwIz6QgGjAXvwM9hyphenhyphenqEIDvwxwe963CwepKH0KsQLlY0IJuVSwjdGYsTdwvcOgQKbdT4/s0/open.gif') no-repeat center center;filter:alpha(opacity=80)}
/* Gallery Sets */
.jdGallery a.gallerySelectorBtn{z-index:15;position:absolute;top:0;left:30px;height:20px;/*width:100px;background:url('img/carousel_btn.gif') no-repeat;*/
text-align:center;padding:0 10px;font-size:13px;background:#333;color:#fff;cursor:pointer;opacity:.4;-moz-opacity:.4;-khtml-opacity:0.4;filter:alpha(opacity=40)}
.jdGallery .gallerySelector{z-index:20;width:100%;height:100%;position:absolute;top:0;left:0;background:#000}
.jdGallery .gallerySelector h2{margin:0;padding:10px 20px 10px 20px;font-size:20px;line-height:30px;color:#fff !important}
.jdGallery .gallerySelector .gallerySelectorWrapper{overflow:hidden}
.jdGallery .gallerySelector .gallerySelectorInner div.galleryButton{margin-left:10px;margin-top:10px;border:1px solid #888;padding:5px;height:40px;color:#fff;cursor:pointer;float:left}
.jdGallery .gallerySelector .gallerySelectorInner div.hover{background:#333}
.jdGallery .gallerySelector .gallerySelectorInner div.galleryButton div.preview{background:#000;background-position:center center;float:left;border:none;width:40px;height:40px;margin-right:5px}
.jdGallery .gallerySelector .gallerySelectorInner div.galleryButton h3{margin:0;padding:0;font-size:12px;font-weight:normal;color:#fff}
.jdGallery .gallerySelector .gallerySelectorInner div.galleryButton p.info{margin:0;padding:0;font-size:12px;font-weight:normal;color:#fff !important}
</style>
<script src='http://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools-yui-compressed.js' type='text/javascript'></script>
<script src='http://hacodeproject.googlecode.com/files/mootoolmore.js' type='text/javascript'> </script>
<script src='http://hacodeproject.googlecode.com/files/smoothgallery.js' type='text/javascript'></script>
<script src='http://hacodeproject.googlecode.com/files/slidetransition.js' type='text/javascript'></script>
Trong đoạn code trên ở dòng đầu tiên chú ý các tham số width:560px;height:200px thể hiện chiều rộng và chiều cao cho panel slide (bạn Hoang Lee có thể điều chỉnh 200px thành chiều cao tương thích theo ý thích của bạn).
Bước 2. Đặt đoạn code sau đây vào một tiện ích HTML/JavaScript và tiện ích này có thể nằm ở trên hoặc dưới phần Blog Posts
<!-- Featured Content Slider Started -->Bạn có thể thêm nhiều slide khác vào dòng …. với định dạng HTML như sau:
<script type='text/javascript'>
function startGallery() {
var myGallery = new gallery($('myGallery'), {
timed: true,
delay: 6000,
slideInfoZoneOpacity: 0.8,
showCarousel: false,
slideInfoZoneSlide: false
});
}
window.addEvent('domready', startGallery);
</script>
<div class='fullbox_excerpt'>
<div class='fullbox_content'>
<div class='smooth_gallery'>
<div id='myGallery'>
<div class='imageElement'>
<h3>Đây là tiêu đề bài viết 1</h3>
<p>Thay thế đoạn văn này bằng nội dung mô tả tóm tắt cho bài viết liên quan đến hình ảnh này.</p>
<a class='open' href='URL_Bài viết 1' title=''></a>
<img alt='' class='full' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWL_aMl6DmNyvKfIkfRleH-yPqy_LW20VhY3ZnLWIQQ1Mpkofgj1b9TEO1YbjqLpOZduOTai1weBI1MfE-0A9xEI55A5hy6ZD2tGC8xeSQO7dxoVArdyV21y9vy66397TbGYeQ1QV1tWg/s0/1.jpg' style="width:560px;height:200px"/>
</div>
<div class='imageElement'>
<h3>Đây là tiêu đề bài viết 2</h3>
<p>Thay thế đoạn văn này bằng nội dung mô tả tóm tắt cho bài viết liên quan đến hình ảnh này.</p>
<a class='open' href='URL_Bài viết 2' title=''></a>
<img alt='' class='full' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-l8Tc9WVqkLMX1kprb2LhfAj9JnbvhvF4p5UJPrGU_RzeZVu5LLm8SK9g_nukiJLCrPCr7n-KfMAQ3W9S-GSD0XB6gzm8CwzrItzeZ6nEHgA4TkEoNEvhM94Z2J4iUY-_PmjOJV1-2CU/s0/2.jpg' style="width:560px;height:200px"/>
</div>
<div class='imageElement'>
<h3>Đây là tiêu đề bài viết 3</h3>
<p>Thay thế đoạn văn này bằng nội dung mô tả tóm tắt cho bài viết liên quan đến hình ảnh này.</p>
<a class='open' href='URL_Bài viết 3' title=''></a>
<img alt='' class='full' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2GjMFQRQZSGDstgjbFPlPayEqHiDzjExVWSZBaTcV3VkpX7PZ7Nybe7jDakmNke0728cv3DeM1cMXOJaC55UDKjVkF0uVTHXNm8TdWasWK3SKdCi2CtEFNvT8me6TqK6w8WOZ_TLjk78/s0/3.jpg' style="width:560px;height:200px"/>
</div>
<div class='imageElement'>
<h3>Đây là tiêu đề bài viết 4</h3>
<p>Thay thế đoạn văn này bằng nội dung mô tả tóm tắt cho bài viết liên quan đến hình ảnh này.</p>
<a class='open' href='URL_Bài viết 4' title=''></a>
<img alt='' class='full' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjz-oHelYdsYg2uKVSNskLkZb5bQeqyuNn6gbunVSJOFy-9fMgM3shw8M5vBTPf7FXjfem8Hp3TUULm6ecIm_rFd-Sgu57AwlChWrTsQSJ2TdlWqOadE-zNaNhI5EQl_TZyPoytfXkNttE/s0/4.jpg' style="width:560px;height:200px"/>
</div>
<div class='imageElement'>
<h3>Đây là tiêu đề bài viết 5</h3>
<p>Thay thế đoạn văn này bằng nội dung mô tả tóm tắt cho bài viết liên quan đến hình ảnh này.</p>
<a class='open' href='URL_Bài viết 5' title=''></a>
<img alt='' class='full' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLYcRfe1VIg42stMmg4M2jtx4HhqSKprPAIo-MujaDoHhIp3cdWdbOGVC_ge2RC1d4GyUVA6h5dkBpFCw-jyuVFBaouhTaxrS1atAR-5WUYxJCkIAGSrfDds31ENqnGRRCGtDLkCkCsUg/s0/5.jpg' style="width:560px;height:200px"/>
</div>
……. // Xóa dòng này nếu bạn không muốn thêm slide
</div></div></div></div>
<!-- Featured Content Slider End -->
<div class='imageElement'>
<h3>Đây là tiêu đề bài viết n</h3>
<p>Thay thế đoạn văn này bằng nội dung mô tả tóm tắt cho bài viết liên quan đến hình ảnh này.</p>
<a class='open' href='URL_Bài viết n' title=''></a>
<img alt='' class='full' src='URL_hình ảnh' style="width:560px;height:200px"/>
</div>
Tăng cỡ chữ
Mặc định
Giảm cỡ chữ
Liên hệ mail: tpm1512@yahoo.com và xem tất cả bài viết trang này
Tại đây
Nhấn vào theo dõi thăm trang web của Trần Phúc Minh
-
https://yogaso1.blogspot.com/2010/12/trinh-chieu-noi-dung-va-hinh-anh-su.html
Minh cám ơn bạn đã quan tâm và rất vui vì bài viết đã đem lại thông tin hữu ích cho bạn.
MENU
Sản phẩm
Trang chủ
Nổi bậc
Tiện ích
Tài khoản
Tác vụ
YOUTUBE
Trang chủ
Lên trên
Tổng số Bình luận [ 0]
Đăng nhận xét