Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery弹出窗口效果在IE中不起作用,但在其他浏览器上起作用_Jquery_Internet Explorer_Popup - Fatal编程技术网

jQuery弹出窗口效果在IE中不起作用,但在其他浏览器上起作用

jQuery弹出窗口效果在IE中不起作用,但在其他浏览器上起作用,jquery,internet-explorer,popup,Jquery,Internet Explorer,Popup,我对IE中的jQuery效果有问题。但是,它们在Chrome、Firefox和Safari中工作正常 我在论坛上搜索过,但找不到问题 该网站是 IE中不起作用的功能是: 弹出窗口的功能: $(document).ready(function() { //When you click on a link with class of poplight and the href starts with a # $('a.poplight[href^=#]').click(function()

我对IE中的jQuery效果有问题。但是,它们在Chrome、Firefox和Safari中工作正常

我在论坛上搜索过,但找不到问题

该网站是

IE中不起作用的功能是:

  • 弹出窗口的功能:

        $(document).ready(function() {
    //When you click on a link with class of poplight and the href starts with a #
    
    $('a.poplight[href^=#]').click(function() {
        var popID = $(this).attr('rel'); //Get Popup Name
        var popURL = $(this).attr('href'); //Get Popup href to define size
    
        //Pull Query & Variables from href URL
        var query= popURL.split('?');
        var dim= query[1].split('&');
        var popWidth = dim[0].split('=')[1]; //Gets the first query string value
    
        //Fade in the Popup and add close button
        $('#' + popID).fadeIn().css({ 'width': Number( popWidth ) }).prepend('<a href="#" class="close"><img src="http://voces.org.es/wp-content/themes/voces/img/close_pop.png" class="btn_close" title="Close Window" alt="Close" /></a>');
    
        //Define margin for center alignment (vertical   horizontal) - we add 80px to the height/width to accomodate for the padding  and border width defined in the css
        var popMargTop = ($('#' + popID).height() + 80) / 2;
        var popMargLeft = ($('#' + popID).width() + 80) / 2;
    
        //Apply Margin to Popup
        $('#' + popID).css({
            'margin-top' : -popMargTop,
            'margin-left' : -popMargLeft
        });
    
        //Fade in Background
        $('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
        $('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); //Fade in the fade layer - .css({'filter' : 'alpha(opacity=80)'}) is used to fix the IE Bug on fading transparencies
        return false;
    });
    
    //Close Popups and Fade Layer
    $('a.close, #fade').live('click', function() { //When clicking on the close or fade layer...
        $('#fade , .popup_block').fadeOut(function() {
            $('#fade, a.close').remove();  //fade them both out
        });
        return false;
    });
    
    $(文档).ready(函数(){
    //当您单击具有poplight类的链接时,href以#
    $('a.poplight[href^=#]')。单击(函数(){
    var popID=$(this.attr('rel');//获取弹出窗口名称
    var popURL=$(this.attr('href');//获取Popup href以定义大小
    //从href URL提取查询变量(&V)
    var query=popURL.split(“?”);
    var dim=query[1]。拆分('&');
    var popWidth=dim[0]。拆分('=')[1];//获取第一个查询字符串值
    //淡入弹出窗口并添加关闭按钮
    $('#'+popID).fadeIn().css({'width':Number(popWidth)}).prepend('');
    //定义中心对齐的边距(垂直-水平)-我们向高度/宽度添加80px,以适应css中定义的填充和边框宽度
    var popMargTop=($('#'+popID).height()+80)/2;
    var popMargLeft=($('#'+popID).width()+80)/2;
    //将边距应用于弹出窗口
    $('#'+popID).css({
    “页边距顶部”:-popMargTop,
    “左边距”:-popMargLeft
    });
    //淡入背景
    $('body').append(“”);//将淡入淡出层添加到body标记的底部。
    $('#fade').css({'filter':'alpha(opacity=80)}).fadeIn();//淡入淡入淡入层-.css({'filter':'alpha(opacity=80)})用于修复淡入透明胶片上的IE错误
    返回false;
    });
    //关闭弹出窗口和淡入层
    $('a.close,#fade').live('click',function(){//单击关闭或淡入淡出层时。。。
    $('#淡入,.popup#u块')。淡出(函数(){
    $(“#淡入,a.close”).remove();//将它们淡出
    });
    返回false;
    });
    
    }))

  • 我一直在努力解决这个问题,这是我的第一个网络项目,但我真的无法解决这个问题。我会很感激你的帮助

    1)在继续之前,请修复所有。我收到一些与散乱标签相关的控制台错误

    /&
    //]>
    标记包围
    中的任何JavaScript,以阻止HTML验证解析JS代码

    <script type="text/javascript" language="JavaScript">
        //<![CDATA[
    
            //  your jQuery/JavaScript
    
        //]]>
    </script>
    
    
    //
    
    2) 确保您使用的是最新版本的jQuery。您使用的是1.4.1版,已经有一年多的历史了。现在已经达到了1.7,并且有了很大的变化

    3) 引用评论:“在IE7或IE8中不起作用,但还没有尝试过IE6。”-如果可能的话,忘掉IE6,专注于IE9


    4) 如果仍然不起作用,请尝试使用jQuery Lightbox插件(经验证可与IE一起使用)作为模式弹出窗口。和都是可靠的选择。

    “不起作用”是一个完全不充分的问题描述。Jquery似乎正在加载,但该函数不会触发弹出窗口。我想更好地解释这个问题,但我真的不知道问题是什么。首先,你没有包括重现问题的步骤,也没有包括哪些IE版本。在IE7或IE8中不起作用,但没有在IE6上尝试过。不确定你通过重现这些问题会遇到什么,我已经发布了一个链接到弹出窗口不起作用的网站。我真的很抱歉,我不能更好地解释我自己,我是编程新手,在论坛上阅读我的第一个项目时我一直在努力,但我真的看不出问题出在哪里。你的网站不是英文的,所以我怎么知道如何调用这个弹出窗口?只要告诉我们点击什么就行了。太好了,听起来是个不错的开始。我会马上开始尝试你的建议,并让你随时了解结果。谢谢只要把钥匙放进去就行了。谢谢Sparky672!