JQuery实现的图文自动轮播效果插件
作者:bea
本文实例讲述了JQuery实现的图文自动轮播效果插件。分享给大家供大家参考。具体如下: intervalID = setInterval(cycleImage, slidetime);$(".main_image .desc").show(); // 展示图片$(".main_image .block").animate({ opacity: 0.85 }, 1 ); // 设置透明度//点击和悬停事件$(".image_thumb ul li:first").addCl
本文实例讲述了JQuery实现的图文自动轮播效果插件。分享给大家供大家参考。具体如下:
intervalID = setInterval(cycleImage, slidetime);
$(".main_image .desc").show(); // 展示图片
$(".main_image .block").animate({ opacity: 0.85 }, 1 ); // 设置透明度
//点击和悬停事件
$(".image_thumb ul li:first").addClass('active');
$(".image_thumb ul li").click(function(){
// 设置参数
var imgAlt = $(this).find('img').attr("alt");
var imgTitle = $(this).find('a').attr("href");
var imgDesc = $(this).find('.block').html(); // 从类block中获取html
var imgDescHeight = $(".main_image").find('.block').height();
// 计算类block的高度
if ($(this).is(".active")) { // 如果已经激活了,之后的操作...
return false;
} else {
// 动画操作
$(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
$(".main_image .block").html(imgDesc).animate({ opacity: 0.85,marginBottom: "0" }, 250 );
$(".main_image img").attr({ src: imgTitle , alt: imgAlt});
});
}
$(".image_thumb ul li").removeClass('active');
$(this).addClass('active');
return false;
}) .hover(function(){
$(this).addClass('hover');
}, function() {
$(this).removeClass('hover');
});
// Toggle Teaser
$("a.collapse").click(function(){
$(".main_image .block").slideToggle();
$("a.collapse").toggleClass("show");
});
希望本文所述对大家的jQuery程序设计有所帮助。
有用 | 无用
intervalID = setInterval(cycleImage, slidetime);
$(".main_image .desc").show(); // 展示图片
$(".main_image .block").animate({ opacity: 0.85 }, 1 ); // 设置透明度
//点击和悬停事件
$(".image_thumb ul li:first").addClass('active');
$(".image_thumb ul li").click(function(){
// 设置参数
var imgAlt = $(this).find('img').attr("alt");
var imgTitle = $(this).find('a').attr("href");
var imgDesc = $(this).find('.block').html(); // 从类block中获取html
var imgDescHeight = $(".main_image").find('.block').height();
// 计算类block的高度
if ($(this).is(".active")) { // 如果已经激活了,之后的操作...
return false;
} else {
// 动画操作
$(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
$(".main_image .block").html(imgDesc).animate({ opacity: 0.85,marginBottom: "0" }, 250 );
$(".main_image img").attr({ src: imgTitle , alt: imgAlt});
});
}
$(".image_thumb ul li").removeClass('active');
$(this).addClass('active');
return false;
}) .hover(function(){
$(this).addClass('hover');
}, function() {
$(this).removeClass('hover');
});
// Toggle Teaser
$("a.collapse").click(function(){
$(".main_image .block").slideToggle();
$("a.collapse").toggleClass("show");
});
希望本文所述对大家的jQuery程序设计有所帮助。
有用 | 无用
猜你喜欢
您可能感兴趣的文章:
- js的flv视频播放器插件使用方法
- 使用Raygun来自动追踪AngularJS中的异常
- 使用JavaScript的AngularJS库编写hello world的方法
- 浅谈setTimeout 与 setInterval
- 简介可以自动完成UI的AngularJS工具angular-smarty
- javascript中传统事件与现代事件
- 浅谈jquery中delegate()与live()
- jquery 中ajax执行的优先级
- jquery中ready()函数执行的时机和window的load事件比较
- jquery中toggle函数交替使用问题
- 浅谈js 闭包引起的内存泄露问题
- js闭包所用的场合以及优缺点分析
- JavaScript创建闭包的两种方式的优劣与区别分析
- javascript中使用new与不使用实例化对象的区别
- 浅谈javascript构造函数与实例化对象
- jquery分析文本里url或邮件地址为真实链接的方法
- jQuery实现文本框输入同步的方法
- jQuery实现带滚动导航效果的全屏滚动相册实例
- jquery实现的代替传统checkbox样式插件