|
|
|
ช่วยทีคับจะแก้ให้คลิกเองและเอาเวลาเปลี่ยนออกแก้ไงคับ JaveScript |
|
|
|
|
|
|
|
Code (Java)
(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);
จะแก้ให้เป็นแบบคลิกเลือกเอง และเอาเวลาเปลี่ยนออกคับ
Tag : Java, HTML/CSS, JavaScript, jQuery
|
|
|
|
|
|
Date :
2014-11-02 23:16:10 |
By :
nung2553 |
View :
665 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลองภาพประกอบหน่อยครับ
|
|
|
|
|
Date :
2014-11-10 20:51:02 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เอาอันนี้ไปทับ
Code (JavaScript)
(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);
|
ประวัติการแก้ไข 2014-11-11 08:58:34 2014-11-11 08:59:42
|
|
|
|
Date :
2014-11-11 08:56:15 |
By :
gaowteen |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|