Simplemodal Scroll Bar and Close Image Issue

时光总嘲笑我的痴心妄想 提交于 2020-01-14 05:53:06

问题


I have a simplemodal jquery popup that has to have overflow set to auto because the resulting list can be long. The scroll bars show up fine, but the close image gets shoved behind the vertical scroll bars and the simplemodal border. If I comment out the

overflow: 'auto',

line the close image shows up fine over the top of the border. I have tried setting the z-index for the image really high and that did nothing. It also makes horizontal scroll bars show up because the close image is behind the vertical scroll bars.

My jquery code is

jQuery('#CustLookupResults').modal({
                        containerCss: {
                            padding: 0,
                            overflow: 'auto',
                            maxHeight: 800

                        },
                        onShow: function (dlg) {
                            $(dlg.container).css('width', 650);
                            $(dlg.container).css('height', 'auto');
                        },
                        overlayClose: true,
                        opacity: 75
                    });

And my css is

#simplemodal-container
{
    border:8px solid;
    padding: 12px;
    border-color:Black;
    border-style:outset;
    background-color:White;
    color:Black;
    vertical-align:middle;
    text-align:center;
}

#simplemodal-container a.modalCloseImg {
    background:url(../images/x.png) no-repeat; /* adjust url as required*/
    width:25px;
    height:29px;
    display:inline;
    z-index:3200;
    position:absolute;
    top:-15px;
    right:-18px;
    cursor:pointer;
}

Any help on how to fix this would be appreciated.


回答1:


SimpleModal should be automatically adding overflow:'auto' to the simplemodal-wrap div if your data extends the container. If for some reason it is not (due to how you are using it), you could do something like:

jQuery('#CustLookupResults').modal({
    containerCss: {
        padding: 0,
        width: 650,
    },
    maxHeight: 800,
    onShow: function (dlg) {
        $(dlg.container).css('height', 'auto');
        $(dlg.wrap).css('overflow', 'auto'); // or try jQuery.modal.update();
    },
    overlayClose: true,
    opacity: 75
});


来源:https://stackoverflow.com/questions/5032490/simplemodal-scroll-bar-and-close-image-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!