Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/231.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
Php jQuery在Chrome和IE中不工作_Php_Javascript_Jquery - Fatal编程技术网

Php jQuery在Chrome和IE中不工作

Php jQuery在Chrome和IE中不工作,php,javascript,jquery,Php,Javascript,Jquery,我正在研究Wordpress的主题。 在标题上,我检查这是否是第一次访问(用户刚刚进入网站) 如果这是第一次访问,将显示动画。动画=边栏出现在页面的中间,在打开的一些毫秒中,页面出现。 在代码中,ub_sb_closed_on_hp是一个选项,它只设置侧边栏显示在主页上 它在Mozilla下工作,但在Internet Explorer和Chrome下不工作。在IE和Chrome上,动画显示在所有页面上 请参见此处的代码:尝试以下更改: if ($_SESSION['first_t

我正在研究Wordpress的主题。 在标题上,我检查这是否是第一次访问(用户刚刚进入网站)

如果这是第一次访问,将显示动画。动画=边栏出现在页面的中间,在打开的一些毫秒中,页面出现。 在代码中,ub_sb_closed_on_hp是一个选项,它只设置侧边栏显示在主页上

它在Mozilla下工作,但在Internet Explorer和Chrome下不工作。在IE和Chrome上,动画显示在所有页面上

请参见此处的代码:

尝试以下更改:

        if ($_SESSION['first_time_here'] == ''):

            //SET PAGE TO CLOSED FOR OPENING
            if (get_option('ub_sb_closed_on_hp') != 'yes'){                     
//              print " 
?>
                if (jQuery(window).width() > 980){              
                    jQuery('#page').css({'display':'inline','width':'300px','overflow':'hidden','margin-right':'340px'});
                    jQuery('#sidebar').css({'margin-left':'326px'});
                }
//              ";
    <?php
            }
        ?>      
if($\u会话['first\u time\u here']=''):
//将页面设置为关闭以打开
如果(获取选项('ub\u sb\u closed\u on\u hp')!='yes'){
//“打印”
?>
if(jQuery(window).width()>980){
css({'display':'inline','width':'300px','overflow':'hidden','margin-right':'340px');
jQuery(“#边栏”).css({'margin-left':'326px'});
}
//              ";
而且:

                    if (get_option('ub_sb_closed_on_hp') != 'yes'){                     
                    ?>
//                      print "
                        if (jQuery(window).width() > 980){                                      
                            jQuery('#sidebar').delay(800).animate({'margin-left':'0px'},2100);      
                            jQuery('#page').delay(800).animate({'margin-right':'0px','width':'666px'},2100);                
                        }                                               
//                      ";
<?php
                    }
                    ?>
if(get_选项('ub_sb_closed_on_hp')!='yes'){
?>
//“打印”
if(jQuery(window).width()>980){
jQuery(“#边栏”).delay(800).animate({'margin-left':'0px'},2100);
jQuery(“#page”).delay(800).动画({'margin-right':'0px','width':'666px'},2100);
}                                               
//                      ";
编辑1:我看不到您在哪里初始化
$\u会话['first\u time\u here']
。如果您没有初始化它,您可以尝试以下更改

查找:
if($\u会话['first\u time\u here']==''):


替换:
if(!isset($\u SESSION['first\u time\u here']):

源代码正常。问题现已解决

问题是我注释了一行插入图像的代码。 这个wordpress主题是以一种奇怪的方式开发的(如果感兴趣,可以搜索帝国)


谢谢大家的建议!

您确定问题是会话不工作,问题不是jQuery不工作吗?要测试这一点,请输入
打印“我处于会话状态”
就在你的会话条件中。很有趣。如果我插入页面没有加载:)-知道为什么吗?哎呀,我没有意识到这个条件被jQuery语句包装了。Do
die(“我在会话中”);
而不是
print
。die在php下工作,但是文本“我在会话中”看起来没有,所以你有
我会尝试回来,稍后再回答,谢谢