我可以在淡入/淡出 JQuery 函数中使用 <a> 标记按钮类吗?
Can I use <a> tag button classes in fade in/out JQuery function?
我有一个jQuery图像拇指滑块,其中每个拇指都是一个"链接到不同div元素的标签按钮。
当用户单击拇指按钮时,我希望关联的div 对淡入进行动画处理,当用户单击另一个时,上一个div 应该淡出并淡入/替换为下一个。
我是jQuery的新手,我花了很多时间研究这个函数的使用,我对那里的许多解决方案感到困惑。
我觉得我在代码中缺少一些东西,但我不知道是什么。
以下是我到目前为止所拥有的:
.CSS
滑 块
#aemcSlider {
list-style:none;
margin-left: 289px;
width: 474px;
height: 97px;
top: 134px;
position: absolute;
overflow: hidden;
left: -3px;
}
#aemcSlider a {
margin-right: -4px;
}
#aemcPkgContainer {
z-index:1;
width: 425px;
height: 675px;
position: absolute;
left: 320px;
top: 233px;
}
#aemcGroundAdContainer {
z-index:2;
display: none;
width: 425px;
height: 675px;
position: absolute;
left: 320px;
top: 233px;
}
#aemcClampOnAdContainer {
z-index:3;
display: none;
width: 425px;
height: 675px;
position: absolute;
left: 320px;
top: 233px;
}
#aemcMetrixContainer {
z-index:4;
display: none;
width: 425px;
height: 675px;
position: absolute;
left: 320px;
top: 233px;
}
按钮
像这样的 4 个按钮//
a.aemcGroundFlexBut {
position:relative;
float: left;
margin: 0 auto;
display: block;
width: 162px;
height: 114px;
background: url(../Images/AEMC_AD_6472-74.png) no-repeat 0 0;
}
a.aemcGroundFlexBut:hover {
background-position: 0 -114px;
}
.HTML
Jquery 滑块
<div id="aemcSlider">
<ul>
<li><a class="aemcPkgBut" href="#"></a></li>
<li><a class="aemcGroundFlexBut" href="#"></a></li>
<li><a class="aemcClampBut" href="#"></a></li>
<li><a class="aemcMetrixBut" href="#"></a></li>
</ul>
</div>
器皿:
有4个这样的容器//
<div id="aemcPkgContainer">
<div class="workImage">
<img src="Images/AEMC_packaging_image.png" alt="Packaging"
width="295" hspace="0" vspace="0" border="0" title="Packaging"/>
</div>
</div>
.JS:
JavaScript 文档
$(document).ready(function () {
$(".aemcPkgBut").click(function () {
$("#aemcGroundAdContainer").fadeOut(2500);
$("#aemcClampOnAdContainer").fadeOut(2500);
$("#aemcMetrixContainer").fadeOut(2500);
$("#aemcPkgContainer").fadeIn(2500);
});
$(".aemcGroundFlexBut").click(function () {
$("#aemcPkgContainer").fadeOut(2500);
$("#aemcClampOnAdContainer").fadeOut(2500);
$("#aemcMetrixContainer").fadeOut(2500);
$("#aemcGroundAdContainer").fadeIn(2500);
});
$(".aemcClampBut").click(function () {
$("#aemcPkgContainer").fadeOut(2500);
$("#aemcGroundAdContainer").fadeOut(2500);
$("#aemcMetrixContainer").fadeOut(2500);
$("#aemcClampOnAdContainer").fadeIn(2500);
});
$(".aemcMetrixBut").click(function () {
$("#aemcPkgContainer").fadeOut(2500);
$("#aemcGroundAdContainer").fadeOut(2500);
$("#aemcClampOnAdContainer").fadeOut(2500);
$("#aemcMetrixContainer").fadeIn(2500);
});
});
以上是行不通的。
我正在使用标签按钮...这可能是问题所在吗?
任何帮助将不胜感激。
谢谢!
我认为这应该不是问题...我尝试使用您的代码来复制该行为。
看看这个小提琴...希望有帮助。
小提琴
$(document).ready(function () {
$(".aA").click(function () {
$('#A').fadeIn(1000);
$('#B').fadeOut(1000);
});
$(".aB").click(function () {
$('#A').fadeOut(1000);
$('#B').fadeIn(1000);
}); });
相关文章:
- 验证动态单选按钮jQuery
- 单击按钮-jQuery/JavaScript时显示表格
- 加载页面时未触发按钮?(JQuery)
- 菜单打开和关闭菜单按钮 - Jquery
- FlatUI - 单选按钮 jQuery 兼容性
- 动作脚本3中的链接按钮 + jQuery 集成中的淡出
- 使用用户名时禁用按钮 jQuery.
- 需要默认的CSS按钮(JQuery)
- 如何将单选按钮的选定值复制到另一个单选按钮 - jquery
- 单击另一个按钮后如何启用按钮 jQuery.
- 在带有弹出窗口的循环中创建一个按钮-jQuery Mobile
- 将下拉覆盖长度选择更改为按钮-jQuery DataTables
- 带有编辑按钮Jquery的待办事项列表
- 按钮jquery ui不工作
- 为函数赋值并在单独的按钮jquery上运行
- 检查表单数据值并禁用提交按钮jQuery表单
- 将鼠标悬停时的按钮替换为另一个不起作用的按钮jQuery
- "打开“;切换按钮jQuery
- 在单击按钮 Jquery 时验证表单
- UL LI元素在单击向上和向下按钮jQuery时自动滚动