Reputation: 72232
The scenario is this.
I've built a top navigation prototype which needs to have an overlay (transparent PNG) image on top of it. It currently covers about 1/3 of the links. Please see below:
Is there any way I can make the top 1/3 of the links respond even-though there's a <div />
covering them partly? The overlay won't contain anything clickable it's only a design feature.
I've never done this and wouldn't imagine it's possible but I look forward to being proven wrong.
Javascript/jQuery
not preferred but will use as a last resort.
Here's a test case on jsFiddle, it directly mimics the structure of my current code.
Upvotes: 2
Views: 6772
Reputation: 5612
Yes, this IS POSSIBLE using pointer-events: none!
CSS
div.overlay {
pointer-events: none;
}
Compatibility for IE (http://caniuse.com/pointer-events) is still non-existent so a conditional CSS statement is required:
<!--[if IE]>
<style type="text/css">
.overlay {
background: none !important;
}
</style>
<![endif]-->
If using an overlay div with CSS gradient background the above is enough. If using a transparent image (png, gif, etc), you'll need to add this to your conditional statement:
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='file-name.png', sizingMethod='scale');
Hope that helps.
Upvotes: 7
Reputation: 91497
For what it's worth, this works in all but ie7, and is almost all CSS. It just requires adding a little html:
Upvotes: 0
Reputation: 228182
There's only one way to do this (as far as I know), and it's not great:
.png
with alpha channel overlaps.background-position
with pixel perfect offsets.I'm lucky that in that demo it only overlapped the last button :)
Upvotes: 1
Reputation:
Hm... use links with no text, with display: block and width and height set. Put inside a DIV as container and z-index to be over the divs from the menu, and position: absolute. Then set the right position for the container. Something like:
.linkOverlay { z-index: 10; display: block; width: 100px; height: 40px; float: left; } .linkContainer{ position: absolute; top: (top here); left: (left here); } [div class="linkContainer"] [a href="page.html" class="linkOverlay"][/a] [a href="page_two.html" class="linkOverlay"][/a] [/div]
That's just the main idea, you will know how to do it :)
Upvotes: 0
Reputation: 11148
the click() event can be emulated via jquery, although it may not apply to your problem...
You could also (as a last resort) replace the navigation and place it on top more or less like an imagemap...
Upvotes: 0
Reputation: 1063
you could make a transparent image the size of the tab and then put that image as a link and position it perfectly over the tab.
Upvotes: 2