悬停时无法单击锚标记,但其显示链接
Unable to click on anchor tag but its showing link while hovering
我无法单击锚标记,但是当我们将鼠标悬停在该链接上时,它会显示链接路径
页面链接
当您单击"现金流分析,税务分析,投资分析"等任何部分时,您会在中心看到一些文本,其中包含不可点击的"阅读更多"链接。
以下是我使用的JS代码:
/*----------Text change on click - Our Process page---------------*/
var prev;
var IdAry = ['slide1', 'slide2', 'slide3', 'slide5', 'slide8', 'slide9', 'slide12', 'slide13', 'slide14', 'slide15', 'slide16'];
window.onload = function () {
for (var zxc0 = 0; zxc0 < IdAry.length; zxc0++) {
var el = document.getElementById(IdAry[zxc0]);
if (el) {
setUpHandler(el);
el.onmouseover = function () {
$(this).addClass("hover");
}
el.onmouseout = function () {
$(this).removeClass("hover");
}
}
}
}
function setUpHandler(el) {
/*---------This is used to add selected class on clicked id only and remove class selected from rest---------*/
$("#" + IdAry.join(",#")).click(function () {
$(this).addClass("selected");
$("#graphics .selected").not(this).removeClass("selected");
})
/*---------This will add show hide class to thier spans and vise versa-------*/
$("#" + IdAry.join(",#")).toggle(
function () {
changeText(this, "hide", "show");
},
function () {
changeText(this, "show", "hide");
})
}
function changeText(obj, cl1, cl2) {
obj.getElementsByTagName('SPAN')[0].className = "hide";
obj.getElementsByTagName('SPAN')[1].className = "show";
if (prev && obj !== prev) {
prev.getElementsByTagName('SPAN')[0].className = "show";
prev.getElementsByTagName('SPAN')[1].className = "hide";
}
prev = obj
}
下面是CSS代码,但我已经向您展示了第1部分(讨论目标和关注点),因为其他部分的其余部分相同:
/-----图形 2 我们的流程页面从这里开始----/
#graphics
{
float:left;
width:100%;
position:relative;
}
#graphics .show a.readmore
{
float:right;
padding:10px 0;
}
#graphics .hover
{
cursor:pointer;
}
span.show
{
display:block;
}
span.hide
{
display:none;
}
#span1
{
font-size:13px !important;
}
#graphics .row1, #graphics .row2, #graphics .row3, #graphics .row4
{
float:left;
width:100%;
}
.circleBg
{
float:left;
position:absolute !important;
top:150px;
left:215px !important;
height:200px;
width:275px;
}
#graphics #slide1 #span1, #graphics #slide2 #span1, #graphics #slide3 #span1, #graphics #slide4 #span1, #graphics #slide5 #span1, #graphics #slide6 #span1, #graphics #slide7 #span1, #graphics #slide8 #span1, #graphics #slide9 #span1, #graphics #slide10 #span1, #graphics #slide11 #span1, #graphics #slide12 #span1, #graphics #slide13 #span1, #graphics #slide14 #span1, #graphics #slide15 #span1, #graphics #slide16 #span1
{
display:none;
}
#graphics #slide1 span.show, #graphics #slide2 span.show, #graphics #slide3 span.show, #graphics #slide4 span.show, #graphics #slide5 span.show, #graphics #slide6 span.show, #graphics #slide7 span.show, #graphics #slide8 span.show, #graphics #slide9 span.show, #graphics #slide10 span.show, #graphics #slide11 span.show, #graphics #slide12 span.show, #graphics #slide13 span.show, #graphics #slide14 span.show, #graphics #slide15 span.show, #graphics #slide16 span.show
{
color:#000;
float:left;
position:absolute !important;
top:150px;
left:215px !important;
height:200px;
width:235px;
background-color:#fff;
text-align:center;
padding:0 20px;
cursor:default;
}
#graphics .row1 #slide1
{
float:left;
width:204px;
height:112px;
background:url('/pages/images/row1-1.jpg') 0 0 no-repeat;
}
#graphics .row1 #slide1.hover, #graphics .row1 #slide1.selected
{
background:url('/pages/images/row1-1.jpg') 0 -112px no-repeat !important;
text-decoration:none !important;
}
下面是 HTML 代码:
<div id="graphics">
<img src="images/circle-bg.jpg" alt="" class="circleBg"/>
<div class="row1">
<div href="#" id="slide1" id="selectedSlide">
<span id="span1"></span>
<span class="hide"></span>
</div>
<div href="#" id="slide2">
<span id="span1"></span>
<span class="hide">At this stage, we sit down together and discuss your life goals and begin to develop a plan for funding them. Without knowing where you want to go, we can't help get you there! This is the time to ask a lot of questions and get to know each other. <a href="">Read More..</a></span>
</div>
<div href="#" id="slide3">
<span id="span1"></span>
<span class="hide">We need to know your current income and expenses in order to gain a better understanding of resources that can be applied toward your financial goals. We also determine the appropriate size of your emergency fund. <a href="">Read More..</a></span>
</div>
<div href="#" id="slide4">
<span id="span1"></span>
<span class="hide"></span>
</div>
</div>
</div>
我的要求只是单击"阅读更多"链接在新选项卡中打开该页面。
提前致谢
"
阅读更多"链接是可点击的。 您只需将 ref 设置为 #
,这会让您无处可去。
问题是这个切换事件而不是切换,当我尝试用这个点击事件替换这个切换事件时,我们必须使用点击事件,它工作得很好:)
旧JS代码:
$("#" + IdAry.join(",#")).toggle( // instead of toggle we can use click event
function()
{
changeText(this, "hide", "show");
},
function()
{
changeText(this, "show", "hide");
})
}
新代码:
$("#" + IdAry.join(",#")).click( //replace toggle with click event
function()
{
changeText(this, "hide", "show");
},
function()
{
changeText(this, "show", "hide");
})
相关文章:
- Jquery在初始页面加载时选中复选框时显示链接的代码
- 当主导航链接悬停时,在侧菜单中显示链接
- 悬停时无法单击锚标记,但其显示链接
- 如何通过mailto在电子邮件中突出显示链接
- 如何在第一次点击时突出显示链接;并在第二次单击时跟随它,除非在其他地方单击,然后重新初始化未高亮显示的状态
- 希望仅为已登录的用户显示链接,否则它显示该链接在AngularJS和NodeJS中被隐藏或禁用
- 点击提交按钮后如何显示链接
- 如何使用 JavaScript 在共享按钮中显示链接
- 如何制作一个按钮,当悬停在上面时,会滑动并显示链接 (JS)
- 有条件地以角度显示链接.js
- JavaScript 函数不显示链接地址
- 显示链接的内容
- 在UI中显示链接函数angularJs的数据
- J汤html解析样式=“;显示:无;不要显示链接
- 将逻辑与幻灯片和隐藏/显示链接起来
- 可以在我的网站的另一个网站的地址栏中显示链接吗
- 如果低于特定的浏览器宽度,请不要显示链接
- 使用javascript在if条件内显示链接
- 如何在文本框中显示链接,并让按钮将其保存到数据库中
- 当用户单击“显示链接”时,显示密码,再次单击时将其隐藏