Fancybox Close button disappearing when clicked

2019-09-02 09:28发布

问题:

I am currently using fancybox version 2.1.5, the problem i am encountering is when I click on the close button "x" on the iframe, the close button "x" disappears rather than closing the iframe. Has anyone else encountered this error while using fancybox? Please visit this page and click "details" and the close button "x" to experience the error. http://www.jerrellkbryant.com/jbcom/portfolio

<div><a class="various small_button shadow none" data-fancybox-type="iframe" href="details/clear.html">View Details</a><a class="small_button shadow"  rel="nofollow" href="http://www.jerrellkbryant.com/redventures/" target="_blank"> Visit Website</a></div>


jQuery(document).ready(function(){
$(".various").fancybox({
    type        :'iframe',
    scrolling   : 'no',
    maxWidth    : 800,
    maxHeight   : 400,
    fitToView   : true,
    width       : '70%',
    height      : '70%',
    autoSize    : false,
    closeClick  : true,
    openEffect  : 'none',
    closeEffect : 'none',
});

回答1:

Generally speaking it's not a good idea to set general CSS rules.

In your style css file you have these rules (from line 286)

a{text-decoration:none; color:#393631}
a:visited{/*opacity:0.8; */ /* A bit basic,but it's a bare minumum... */}
a:hover{text-decoration:none; /*background:#c1f4e3;*/ color:#393631}
a:active, 
a:focus{position:relative; top:1px; outline:none}

that are affecting the position of fancybox close button (which is an anchor)

Use some specificity instead so only those you target are affected like :

#content a{text-decoration:none; color:#393631}
#content a:visited{/*opacity:0.8; */ /* A bit basic,but it's a bare minumum... */}
#content a:hover{text-decoration:none; /*background:#c1f4e3;*/ color:#393631}
#content a:active, 
#content a:focus{position:relative; top:1px; outline:none}