单击时交叉淡入淡出背景图像
cross fade background image on click
这里的java脚本代码是自动幻灯片图像,但当我单击.box1 classes时,我需要将其转换为onclick代码。
当我点击box1类时,crossfade只需要对id=#main中的背景图像产生影响。交叉淡入度不能影响框1,并且它必须在背景图像交叉淡入时连续出现。
对于背景图像的交叉渐变,图像必须直接连接到图像文件夹为此,我需要连接#main中的图像文件夹和背景图像。
一些身体能帮上忙吗。
我的代码在这里
var timer = setInterval(nextImage, 4000);
var curImage = 0;
var numImages = 5;
function nextImage() {
var e;
// remove showMe class from current image
e = document.getElementById("slideimg" + curImage);
removeClass(e, "showMe");
// compute next image
curImage++;
if (curImage > numImages - 1) {
curImage = 0;
}
// add showMe class to next image
e = document.getElementById("slideimg" + curImage);
addClass(e, "showMe");
}
function addClass(elem, name) {
var c = elem.className;
if (c) c += " "; // if not blank, add a space separator
c += name;
elem.className = c;
}
function removeClass(elem, name) {
var c = elem.className;
elem.className = c.replace(name, "").replace(/'s+/g, " ").replace(/^'s+|'s+$/g, ""); // remove name and extra blanks
}
检查以下JSfiddle以更改clcik 上的图像
http://jsfiddle.net/arunberti/cwP5Q/99/
将函数写入以下代码中
$('#container').click(function() {
});
相关文章:
- 将淡入淡出添加到“我的身体背景滑块”
- 具有淡入淡出效果的全背景图像
- 试图让我的引导程序navabar背景淡出滚动在我的wordpress主题
- 滑动/淡入淡出背景图像
- 向上滚动导航栏背景淡出
- j在鼠标上查询输入背景颜色淡入淡出
- jQuery是否提供带有背景淡入淡出小部件的叠加层
- JavaScript 动态淡入淡出背景图像
- 如何在三.js中淡入/淡出背景
- 使用jQuery交叉淡入淡出背景图像
- 淡出背景图像
- 使用滚动在视差上淡出背景图像
- 淡入淡出背景颜色更改动画会滞后并减慢速度
- 单击时交叉淡入淡出背景图像
- jquery的原始Javascript 's淡出背景
- jQuery fadeIn淡出背景问题
- 使用JQuery下拉菜单淡出背景页面
- 同时淡入和淡出背景图像
- 使用jQuery/css淡出背景图像
- 如何使用javascript/ASP.NET/CSS旋转和淡出背景图像