为jquery幻灯片动画添加不透明度效果
Adding opacity effect to jquery slide animation
我试图将不透明度效果(从0到1)添加到这里某处张贴的代码(由用户/1022305/trevor)。还没有结果(我还是jquery初学者)。
下面是代码作者的小提琴:http://jsfiddle.net/trevordowdle/S7n2b/
有什么建议应该实现哪一行代码?它可能是一行,如:
opacity:'toggle'
试过了,没有用…
更新代码:
// JavaScript Document
$(document).ready(function(){
var stop = true;
var hovered;
var timeout;
$('.nav').hover(
function(){
clearTimeout(timeout);
stop = true;
hovered = this;
timeout = setTimeout(function(){
if($(hovered).hasClass('nav_menu_link_drop')){
$('.content').css('z-index',0);
$(hovered).next('.content').css('z-index',5);
$(hovered).next('.content').slideDown({
duration: 400,
easing: 'jswing',
});
timeout = setTimeout(function(){
$('.content').not($(hovered).next('.content')).slideUp({
duration: 200,
easing: 'easeInSine',
});
},100);
$(hovered).next('.content').fadeIn(100);
}
else
$('.content').slideUp(350);
},400);
},
function(e){
stop = false;
clearTimeout(timeout);
setTimeout(function(){
if(!stop)
$('.content').slideUp(350);
$('.content').fadeOut(350);
},500);
}
);
$('.content').hover(
function(){
stop = true;
},
function(){
}
);
$('#nav_menu').hover(
function(){
},
function(){
timeout = setTimeout(function(){
$('.content').slideUp(350);
},200);
}
);
});
所以我添加了这两行代码:
$(hovered).next('.content').fadeIn(100);
和
$('.content').fadeOut(350);
以与示例相同的方式更改不透明度的代码是:
$( "yourdivname" ).fadeIn();
和
$( "yourdivname" ).fadeOut();
但是没有一些代码显示你到目前为止所尝试的,我无法解释你将如何使用它个人情况
查看此示例:
http://jsfiddle.net/S7n2b/84/我已经给出了每个li
的id<li id="d0"><a class="nav_menu_link nav">Home</a></li>
<li class="nav_menu_link_drop nav" id="d1">
<a class="nav_menu_link">DropDown 1</a>
</li>
$('#d1').hover(
function(){
$('#content1').fadeIn();
$('#content2').fadeOut();
}
);
$('#d0').hover(
function(){
$('#content1').fadeOut();
$('#content2').fadeOut();
}
);
$('#d2').hover(
function(){
$('#content1').fadeOut();
$('#content2').fadeIn();
}
);
$('#nav_menu').hover(
function(){
},function(){
$('#content1').fadeOut();
$('#content2').fadeOut();
}
);
相关文章:
- 如何更改文本框控件的不透明度值
- 在js中访问元素时不透明度和样式未定义,但在css中定义
- 元素不会添加到Javascript数组中
- Greenstock不透明度动画从0到1再返回
- 如何在html画布上替换ByImage()而不是drawImage()(忽略不透明度)
- 设置1400个Raphael.js对象的不透明度动画会影响动画性能
- 选中复选框时降低父级的不透明度
- 更改alphaMap不透明度不会更新(THRE.JS R76)
- jQuery appendTo 替换元素而不是添加元素,如果正在添加的元素预先存在于列表中
- 如何在页面向下滚动时获得图像以获得不透明度
- 在Materialize设计中删除转盘图像的不透明度
- 如何删除javascript中的不透明度
- 为不透明度和位置添加动画效果
- 在 JavaScript 中添加不透明度无法正常工作
- 将不透明度层添加到带有侧边栏的HTML部分.js / jQuery
- 在R传单中添加不透明度滑块
- 为jquery幻灯片动画添加不透明度效果
- 为页面添加不透明度
- 如何用javascript添加从0到100的不透明度
- 不透明度没有在ie8中添加生成的html