Fancybox - Image is overflowing off right side of lightbox

后端 未结 4 955
太阳男子
太阳男子 2021-01-06 15:25

Looks like this question has been asked before, here, but the asker solved his own question by switching to prettyPhoto. I\'d prefer to figure out why this is happening, jus

4条回答
  •  自闭症患者
    2021-01-06 15:45

    In your style.css file you have the famous box-sizing css rule

    * {
        -moz-box-sizing: border-box;
     -webkit-box-sizing: border-box;
          -o-box-sizing: border-box;
         -ms-box-sizing: border-box;
             box-sizing: border-box;
    }
    

    which seems to be messing the (old version of) fancybox layout : DEMO

    The workaround is to revert box-sizing to content-box for fancybox elements only so apply this css rule after your general box-sizing declaration :

    #fancybox-wrap, #fancybox-wrap *{
        -moz-box-sizing: content-box;
     -webkit-box-sizing: content-box;
          -o-box-sizing: content-box;
         -ms-box-sizing: content-box;
             box-sizing: content-box;
    }
    

    DEMO fixed

    NOTE : This only apply to fancybox v1.3.x and lower. Fancybox v2.x doesn't have this issue.

提交回复
热议问题