jquery - How to create tab into a link -


i have following html:

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

the figcaption shown on image when hovered.

how can make link href of anchor tag, clicking on figcaption takes user 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: 0.6s ease;     -moz-transition: 0.6s ease;     -o-transition: 0.6s ease;     cursor: pointer; } .captionbottom:hover figcaption {   opacity: 1;   cursor: pointer; } 

using jquery:

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

Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -