Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > บทความจากสมาชิก > Simple jQuery Hover Image Gallery Version 2.0 by PlaKriM



 
Clound SSD Virtual Server

Simple jQuery Hover Image Gallery Version 2.0 by PlaKriM

Simple jQuery Hover Image Gallery Version 2.0 by PlaKriM

Screenshort
Simple jQuery Hover Image Gallery

Version 2.0 เพิ่มให้รูป fadeIn fadeOut ให้ดูเลื่อนหูเลื่อนตามากขึ้น แล้วก็ปรับ coding plugin ตัวน้อยๆ ของผมนิดหน่อย ไม่ต้องพูดพร่ำทำเพลง ดูโค๊ดเลยละกัน

index.html
Code (PHP)
<!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>Simple jQuery Hover Image Gallery Version 2.0 by PlaKriM</title>
<style type="text/css">
#SimpleGallery{
	padding:5px;
	margin:0px;
}
#SimpleGallery div{
	float:left;
	font:bold 12px Tahoma;
	text-align:center;
	width:320px;
	padding:0px;
	margin:0px;
}
#SimpleGallery ol{
	float:left;
	width:110px;
	padding:0px;
	margin:0px;
}
#SimpleGallery li{
	width:50px;
	height:50px;
	padding:1px;
	margin:0px;
	float:left;
	list-style:none;	
}
#SimpleGallery li img{
	border:0px;
}
</style>
<script type="text/javascript" src="jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="jquery.simple.gallery.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$('#SimpleGallery').SimpleGallery({activeItem:0});
	});
</script>
</head>

<body>
    <div id="SimpleGallery">
        <div><img /><span></span></div>
        <ol>
            <li><a href="images/large/1.jpg" title="Description of image 1"><img src="images/thumb/1.jpg" /></a></li>
            <li><a href="images/large/2.jpg" title="Description of image 2"><img src="images/thumb/2.jpg" /></a></li>
            <li><a href="images/large/3.jpg" title="Description of image 3"><img src="images/thumb/3.jpg" /></a></li>
            <li><a href="images/large/4.jpg" title="Description of image 4"><img src="images/thumb/4.jpg" /></a></li>
            <li><a href="images/large/5.jpg" title="Description of image 5"><img src="images/thumb/5.jpg" /></a></li>
            <li><a href="images/large/6.jpg" title="Description of image 6"><img src="images/thumb/6.jpg" /></a></li>
            <li><a href="images/large/7.jpg" title="Description of image 7"><img src="images/thumb/7.jpg" /></a></li>
            <li><a href="images/large/8.jpg" title="Description of image 8"><img src="images/thumb/8.jpg" /></a></li>
            <li><a href="images/large/9.jpg" title="Description of image 9"><img src="images/thumb/9.jpg" /></a></li>
            <li><a href="images/large/10.jpg" title="Description of image 10"><img src="images/thumb/10.jpg" /></a></li>
        </ol>
    </div>
</body>
</html>









jquery.simple.gallery.js
(function($){
  	$.fn.SimpleGallery = function(_config){

		var 	_config = $.extend({
			swapDuration: 3500,
			fadeOutDuration: 200,
			fadeInDuration: 500,
			activeItem : 0
		}, _config);
		
		function _view($item){

			var $SG = $('#SimpleGallery');
			var itemCount = $SG.find('li').length;
			var itemIndex = ($item.index() + 1);

			if((itemIndex+1) != _config.activeItem && !(_config.activeItem == 0 && itemIndex == itemCount)){
				_config.activeItem = itemIndex;
				if(_config.activeItem == itemCount){
					_config.activeItem = 0;
				}
				$SG.find('div')
					.stop() // Stop current effect
					.fadeTo(0, 1) // Reset image's opacity
					.fadeOut(_config.fadeOutDuration, function(){ // Start image's fade in for hide old image item
						$(this).find('img').attr('src',$item.find('a').attr('href')); // Set current image
						$(this).find('span').text($item.find('a').attr('title')); // Set current description
						$(this).fadeIn(_config.fadeInDuration); // Start image's fade out for show current image item
					});
			}
		}
		
		function _play(){
			_view($('#SimpleGallery').find('li').eq(_config.activeItem));
		}
		
		return this.each(function (){
			_play();
			var _interval = setInterval(_play, _config.swapDuration);
			$(this).find('li').hover(function(){
				if(_interval){
					clearInterval(_interval);
				}
				_interval = setInterval(_play, _config.swapDuration);
				$('#SimpleGallery').find('div').show();
				_view($(this));
			}).find('a').click(function(){return false;});
		});
  	}
})(jQuery);


ดาวน์โหลดไปลองเล่นได้เลยครับ

บทความอื่น ๆ ที่เกี่ยวข้อง
Go to : jQuery Tutorial : สอน jQuery เขียน jQuery กับ JavaScript เรียน jQuery ในประเทศไทย


Reference : http://www.jquery.com
   
Share
Bookmark.   

  By : PlaKriM
  Article : บทความเป็นการเขียนโดยสมาชิก หากมีปัญหาเรื่องลิขสิทธิ์ กรุณาแจ้งให้ทาง webmaster ทราบด้วยครับ
  Score Rating :
  Create Date : 2011-03-10
  Download : Download  Simple jQuery Hover Image Gallery Version 2.0 by PlaKriM (0.5692 MB)
Sponsored Links
ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







Load balance : Server 04
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่