SearchForKnowledge
SearchForKnowledge

Reputation: 3751

How to create tab into a link

I have the following HTML:

<div class="captionBottom">
    <a href="mp.aspx" title=""><img src="c.jpg" alt="" /></a>
    <figcaption>View!</figcaption>
</div>

The figcaption is shown over the image when hovered.

How can I make that a link to the href of the anchor tag, so clicking on the figcaption also takes the user to mp.aspx

CSS:

figcaption {
    width: 100%;
    position: absolute;
    background: #e55302;
    background: rgba(229,83,2,0.90);
    color: #FFF;
    padding: 10px 0;
    opacity: 0;
    -webkit-transition: all 0.6s ease;
    -moz-transition: all 0.6s ease;
    -o-transition: all 0.6s ease;
    cursor: pointer;
}
.captionBottom:hover figcaption {
  opacity: 1;
  cursor: pointer;
}

Upvotes: 1

Views: 57

Answers (2)

Bralemili
Bralemili

Reputation: 132

Using jQuery:

$('figcaption').on('click',function()
{
    var figHref = $(this).prev().attr('href');
    window.location.href = figHref; //changed the code.
});

Upvotes: 2

Liglo App
Liglo App

Reputation: 3819

<a href="mp.aspx" title="">
 <img src="c.jpg" alt="" />
 <figcaption>View!</figcaption>
</a>

Upvotes: 2

Related Questions