Skip to content Skip to sidebar Skip to footer

Link Within A Link?

i'm using an iframe within my html, loading an image gallery i found from the web. Each img has an information bar you can click on, and when the bar opens it provides viewers with

Solution 1:

http://jsfiddle.net/4YPvp/

.link {
    position: relative;
}
.link span {
    position: absolute;
}

<a class="link" href="http://cnn.com">
    <img src="http://placehold.it/150x100" data-big="" data-title="test title" data-description="test description"/>
    <span data-url="http://npr.org">Other link</span>
</a>

$('.link span').click(function (e) {
    e.preventDefault();
    window.location = $(this).attr('data-url');
});

Note that I used jQuery for this example.


Solution 2:

HTML does not allow the nesting of links, although you can hook up a JavaScript-based click handler that changes the behaviour of the link.

More details are needed to answer your question fully.


Post a Comment for "Link Within A Link?"