简体   繁体   English

IE 7的Fancybox弹出警告

[英]Fancybox Pop Up Warning for IE 7

I am trying to create a fancybox/lightbox warning that will display when a user visit my site using IE7. 我正在尝试创建一个fancybox / lightbox警告,该警告将在用户使用IE7访问我的网站时显示。 I was digging around on the Fancybox website and I came across this script that will allow the fancybox to display on the page launch. 我在Fancybox网站上四处浏览,发现了此脚本,该脚本将使fancybox可以在页面启动时显示。 The I added an IE7 if statement to the mix. 我在混合中添加了IE7 if语句。 So my final code was something similar to the one below: 所以我的最终代码类似于以下代码:

<!--[if IE 7]>
jQuery(document).ready(function() {
$.fancybox(
    '<h2>Hi!</h2><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam quis mi eu elit tempor facilisis id et neque</p>',
    {
            'autoDimensions'    : false,
        'width'                 : 350,
        'height'                : 'auto',
        'transitionIn'      : 'none',
        'transitionOut'     : 'none'
    }
);
});
<![endif]-->

In short it didnt work. 简而言之,它没有用。 I put the code right after my body and also just to be clear I did have all of the js files and jquery files enabled in my head. 我将代码放在我的身体后面,也为了清楚起见,我确实启用了所有js文件和jquery文件。 Any ideas on how I can get this to work? 关于如何使它起作用的任何想法? Is there a better solution out there for doing this? 有没有更好的解决方案呢?

<!--[if IE 7]>
<script>
jQuery(document).ready(function() {
$.fancybox(
    '<h2>Hi!</h2><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam quis mi eu elit tempor facilisis id et neque</p>',
    {
            'autoDimensions'    : false,
        'width'                 : 350,
        'height'                : 'auto',
        'transitionIn'      : 'none',
        'transitionOut'     : 'none'
    }
);
});
</script>
<![endif]-->

You need the <script> tag. 您需要<script>标记。

You could use a browser sniffing script instead of conditional commenting... 您可以使用浏览器嗅探脚本来代替条件注释...

Something like: 就像是:

if($.browser.msie && parseInt($.browser.version) < 8){ // This would catch IE7 and below
    //fancybox script   
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM