Thứ Năm, 2 tháng 6, 2011

Trình diễn slide ảnh đơn giản trong blogspot

Đầu tiên các bạn vào Thiết kế -> Thêm tiện ích -> HTML/Javascript, sau đó dán toàn bộ đoạn mã sau vào tiện ích, chỉnh sửa Link_anh và Link_lien_ket_den_anh là OK:
<embed type="application/x-shockwave-flash" src="http://img694.imageshack.us/img694/7500/beautifuldreamblogslide.swf?http://i465.photobucket.com/support/http://vn.myblog.yahoo.com/cindy-babylove" flashvars="config=4&amp;bcastr_flie=Link_anh1|Link_anh2&amp;bcastr_link=Link_lien_ket_den_anh1|Link_lien_ket_den_anh2" wmode="transparent" width="500height="300"></embed>


Bây giờ là phần chỉnh sửa:
config=4: tốc độ thay đổi ảnh 1 -> 10, số càng lớn, tốc độ thay đổi ảnh càng nhanh, nên chọn 4 là phù hợp nhất.
Link_anh1: thay bằng link ảnh của bạn
Link_lien_ket_den_anh1: thay bằng kink liên kết đến một trang nào đó mà bạn thích ( thứ tự phù hợp với link ảnh nha bạn)
width=500, height=300: bạn tùy chỉnh chiều dài và chiều rộng ảnh hiện thị tại đây.

Cuối cùng Save lại là xong. Nếu thấy hay thì đừng quên để lại comment cho mình nha!

Trình diễn ảnh chuyên nghiệp với prettyPhoto


Trong quá trình tìm hiểu các theme Wordpress mới thì mình có để ý là các designer thường sử dụng một plugin của jQuery là prettyPhoto cho các theme của họ để trình diễn ảnh.

Đây là một dạng lightbox nhưng có nhiều chức năng hơn như hiển thị cả video và flash. Trang web của bạn sẽ trở nên chuyên nghiệp hơn nếu sử dụng plugin này. Muốn biết nó như thế nào thì bạn click vào hình ở dưới:


Kiểu default
prettyPhoto Example

Hiển thị dạng gallery:

GalleryGalleryGallery

Trình diễn Video:

Để sử dụng được plugin này trên blogspot thì bạn chèn đoạn code sau phía trên thẻ</body>
<link href='http://www.no-margin-for-errors.com/wp-content/themes/NMFE/css/prettyPhoto.css' media='screen' rel='stylesheet' type='text/css'/>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js' type='text/javascript'/>
<script src='http://www.no-margin-for-errors.com/wp-content/themes/NMFE/js/jquery.prettyPhoto.js' type='text/javascript'/>
<script type='text/javascript'>
jQuery("a[rel^='prettyPhoto']").prettyPhoto();
</script>

Sau đó, trong khi đăng ảnh trong bài thì bạn thêm dòng rel="prettyphoto" như thế này:
<a href="image.jpgrel="prettyphoto"><img src="..."/></a>

Để hiển thị kiểu gallery thì sửa thành rel="prettyPhoto[pp_gal]" , còn muốn xem video thì thay link ảnh image1 thành link dẫn tới video đó, ví dụ như :http://www.youtube.com/watch?v=_EC2tmFVNNE

Thứ Tư, 1 tháng 6, 2011

Trình chiếu nội dung và hình ảnh sử dụng Mootools



Theo yêu cầu của bạn Hoang Lee tại blogebeat5.blogspot.com, bạn ấy muốn tiện ích Feature Slideshow trên blog ebeat5.blogspot.com có nút chuyển slide sang trái và sang phải giống như trangplayrecords.net.

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.

XemDemo.

Để 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/AVvXsEgBi3QXEkT-8orpg57LHNZPyCVeXfCl_iDB7dan3h4YQ8C0CrGm48nTF2E2HRw4rp6tzw-zG9DKe3tMJvDhp39woBKv2rcOu4pNx_02wAGgCvrDcDiUEW4tAuIhyKlR1x3skxQNP0q1F2A/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/AVvXsEgBi3QXEkT-8orpg57LHNZPyCVeXfCl_iDB7dan3h4YQ8C0CrGm48nTF2E2HRw4rp6tzw-zG9DKe3tMJvDhp39woBKv2rcOu4pNx_02wAGgCvrDcDiUEW4tAuIhyKlR1x3skxQNP0q1F2A/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/AVvXsEiukDueg3x0_9bdamBQ1e0pY_c6UMiE00oBLr9jbcymGltMHr6VkIYxnKqFP1iQP5rNYcEhHA82r7l3a77x1Cmlkomz1B6NaOThTPmPv_rV8q8FsHEUXKdlwhk2iwgBTjyoZcIRJ268lO4/s0/open.png') no-repeat center center}
* html .withArrows a.open:hover{background:url('https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1GocHZNvhzj-xs5kr0rbd1rU9hfpxQlknFtyVYZ23a2k_w9lRsvXAid_aZuLmNS9p6XVs5iw_p9wYeKRKtWQGgkLHp_cpI_m7wE-amTWhWLVDeEP71JslJRMNxfsZ3Ptx9osKTQYaEaE/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 -->
<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/AVvXsEgcRKAp3oUedXgPR-uGuphhiSeYRvsfi0jiY6ZXQ6iJekLlPopcfGpyfVr852n8JL1RUhuRPwHKv2V-FqSefAnArfAfLwRl6mpiNW1-362TeS6hxg-wJCqcy6fLYChytVxDnq4TAc98k6k/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/AVvXsEhJ3VobxqYmASI-deVU9vfZF0ppb85Jse6_2gn76dRd1DO0GGOHKZ-4aN81-VDP3lFLHyUcL0GN8Zfq5ZJJOhpPbs7w0c7YR159Yj70g_dgonaBsyzrstXN6sRd2u6rxwlikD1FzlKjPWQ/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/AVvXsEjQfOishumH2_fBIuFTgy_3IuYwdH7Z2j9j0DckoALnvfU9qZDj7Z7G62cg6iX07fspQKkTkyZuvoPjSIVjyIBUgPVDh4fzXVjuMPLkTgPOzSY0Ds1hjAVrQDAw03SF_9fp_J-7lpcA1HI/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/AVvXsEi5jMeQL_Lvyt5rQICOfFoUtg2dn4l7IEeUdsBD-o3q54VEi-ta5tLms5T273Cgr7FZLyYO31fy7akguf6J9eZpjkQYC689Kk-lTlVh__Z-Pr3LezdZZSU4iX6RILuRDJ57DXYsMT5SV-o/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/AVvXsEiESkKLqV3-876JA6zkc1qCIA3-InpVkKLvqVzpgAig9wTMx8yTjPnYNk8mIRBQy4iL3NrGnAlhzDoo5uYUhQpddat_gmJzXeaTQ3ApvLxdkvfADGGw86LMkcpC2AOUgsfRqgVINjjNWO4/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 -->

Bạn có thể thêm nhiều slide khác vào dòng …. với định dạng HTML như sau:

<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>

Bài viết liên quan

Related Posts Plugin for WordPress, Blogger...