开发者

Transparent overlay div allows click trough in IE 7,8

I have a div containing form elements, and I'm using an invisible overlay mask, which should cover my container. But without background IE 7 and 8 (incorrectly) allows click trough.

The solution I found, is to use background color on the overlay div with 0.1 opacity. This is partially working, but in my case the container elements are sortable items, and when I'm starting a sort, the form elements are acting strange (only when i'm using the opacity option on the jquery sortable as well)

Sample Markup:

<div class="sort">
    <div class="cont">
        <div class="mask"></div>
        <label for="test">Test</label>
        <input type="text" value="Some" name="test" id="test" />
    </div>
    <div class="cont">
        <div class="mask"></div>
        <label for="test">Test</label>
        <select value="Some" name="test2" id="test2">
            <option value="1">Option 1</option>
            <option value="2">Option 2</option>
        </select>
    </div>
</div>

CSS:

.cont {
    width: 300px;
    position: relative;
    background-color: #aaa;
    padding: 10px;
    margin: 10px;
}
.mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    opacity: 0.1;
    filter: alpha(opacity=0.1);
}

Javascript:

$(function() {
开发者_StackOverflow社区    $('.sort').sortable({opacity:0.8});
});

Live on http://jsfiddle.net/CmU59/4/

Any other workaround suggestions?


Although I don't understand why you would want to overlay your from elements have you considered using a fully transparent 1x1px PNG as your overlay background?


background:url(about:blank) maybe a good choice~~


just put background: url(image/url.jpg) no-repeat -999px -999px; and remove opacity...

I suggest you use small image... but not 1x1 pixel... 1x2 will be good... demo

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜