简体   繁体   English

在悬停时无法单击锚标记但显示链接

[英]Unable to click on anchor tag but its showing link while hovering

I am not able to click on anchor tag but when we hover over that link it shows link path 我无法点击锚标记,但当我们将鼠标悬停在该链接上时,它会显示链接路径

Page Link 页面链接

When you click on any section like CASH FLOW ANALYSIS, TAX ANALYSIS, INVESTMENT ANALYSIS etc you will see some text in center with Read more link which is not clickable. 当您点击任何一个部分,如现金流量分析,税收分析,投资分析等,您将看到一些文本在中心与阅读更多链接,这是不可点击的。

Below is the JS code that i have used: 下面是我使用的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
}

Below is the CSS code but i have show you till section 1 (DISCUSS GOALS AND CONCERNS) because rest is same for other sections: 下面是CSS代码,但我已经告诉你第1节(讨论目标和关注),因为其他部分的休息是相同的:

/ -----Graphics 2 our process pages starts here---- / / -----图形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;
}

Below is HTML code: 以下是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>

My requirement is just to click on Read More link open that page in new tab. 我的要求就是点击“阅读更多”链接在新标签页中打开该页面。

Thanks in Advance 提前致谢

The Read More link is clickable. 阅读更多”链接是可点击的。 You just have the ref set as # , which takes you nowhere.. 你只需将参考设置为# ,它就会让你无处可去..

The problem is with this toggle event instead of toggle we have to use click event when i tried to replace this toggle event with this click event it work well :) 问题是这个切换事件而不是切换我们必须使用点击事件当我试图用这个点击事件替换这个切换事件它运作良好:)

Old JS code: 旧JS代码:

$("#" + IdAry.join(",#")).toggle( // instead of toggle we can use click event
function() 
{ 
    changeText(this, "hide", "show"); 
},
function() 
{ 
    changeText(this, "show", "hide"); 
})
}

New code: 新代码:

$("#" + IdAry.join(",#")).click( //replace toggle with click event
function() 
{ 
    changeText(this, "hide", "show"); 
},
function() 
{ 
    changeText(this, "show", "hide"); 
})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 点击Enter键上的锚标记链接 - Click anchor tag link on enter press 自动点击jsp页面上的锚标签链接 - automatically click anchor tag link on jsp page 如何在不知道锚标记内的文本的情况下在 python 中使用 selenium 驱动程序单击链接 - how to click a link using selenium driver in python while don't know the text inside anchor tag 如何在单击时获取锚标记的 ID 并将其传递到 servlet 页面? - How to get id of anchor tag on its click and pass it on to a servlet page? 如何使用它的类点击自我链接的锚标签? - How to get the click on self linked anchor tag using its class? 仅在定位标记链接时使用网页上的 Tab 按钮导航时,我想让空格键充当回车键单击 - While navigating using Tab button on a web page only when at a anchor tag link, I want to make spacebar act as a enter key click 无法左键单击锚标签的链接 - Cannot left-click go to an anchor tag's link 根据URL中的定位标记激活页面加载上的链接点击 - Activate a link click on page load based on anchor tag in URL 在不刷新表单的情况下在锚链接单击事件上调用标签库? - Invoke a tag library on anchor link click event without form refresh? 我无法在引导工具提示中单击html锚标记中的链接 - I am not able to click on link in html anchor tag in bootstrap tooltip
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM