css - jQuery: offset issues -
i have strange jquery.offset() problem.
components being layered , taking away functionality of links underneath. upper layer transparent , empty.
my solution iterate on links (all a
elements), grab location (top, left, height , width values) , href, , create new a
element @ same position, placed in upper layer.
problem: method works 3 out of 4 links. in 1 case, new element located about 120px off top, size , offset left fine. ideas on last one?
$("#container a").each(function(index){ var top = $(this).offset().top; var left = $(this).offset().left; var width = $(this).width(); var height = $(this).height(); var href = $(this).attr("href"); $('<a id="layer'+index+'"></a>').addclass("overlayer").css("left", left).css("top", top).css("width", width).attr("href", href).css("height", height).appendto('#toplayer'); }
note: #container
lower layer links, #toplayer
the upper layer.
the css class .overlayer:
.overlayer { background-color: #cc00cc; position: absolute; z-index: 10; cursor: hand; }
if browser support pointer-events: none
enough you, use upper covering layer instead of js hacks.
some older ies don't support have "feature" can click through boxes without background maybe use.
Comments
Post a Comment