小编Dan*_*zen的帖子

使用HTML选择Chrome中的奇怪行为

我有一个非常简单的CSS菜单,它在悬停时显示UL列表.从前段时间开始,在Chrome中,当我选择与隐藏菜单位于同一位置的选项时display: none,我会将菜单悬停.

选择选项如何在点击时悬停隐藏的对象?这只发生在Chrome上.

我试图将选择z-index更改为更高.将菜单的z-index更改为-1,直到父级ul悬停,但没有成功,仍然会出现问题

是一个代码

尝试选择test5选项:

ul.menu ul {
    display: none !important;
}

ul.menu li:hover>ul {
    display: block !important;
}

ul.menu ul {
    position: absolute;
    left: -1px;
    top: 98%;
}

ul.menu ul ul {
    position: absolute;
    left: 98%;
    top: -2px;
}

ul.menu, ul.menu ul {
    margin: 0;
    list-style: none;
    padding: 2px;
}

ul.menu li ul.links {
    margin: 0;
    list-style: none;
    padding: 0;
    border-color: #AAAAAA;
    border-width: 1px;
    border-style: solid;
}

ul.menu ul.links li {
    margin: 0px;
    list-style: none; …
Run Code Online (Sandbox Code Playgroud)

html css html-select google-chrome

9
推荐指数
1
解决办法
889
查看次数

服务器发送事件 PHP 阻塞流

我不知道它是否有问题,但是,我使用 Server Sent 事件而不是 ajax 来做从 php 到 javascript 的提要。除了在服务器端睡眠,保持事件源阻止网页流之外,一切正常。我做了一个非常简单的代码来测试,我得到了相同的结果。

我会把代码放在上面。

服务器发送事件挂起页面流?它不像 ajax 那样做异步请求?

主要问题是:服务器发送的事件挂起代码流,我的意思是,页面等待 EventSource 保持代码执行,每次 eventSouce 打开连接或接收消息。当我在服务器端代码上休眠时,我可以清楚地看到这一点,我的页面在休眠时间停止,运行 3 秒,然后再次挂起。当我执行 ajax 调用时,调用是异步的,因此即使我在服务器端休眠,代码也会在后台使用 ajax 继续运行。我希望你现在能理解=p

测试文件

                    @set_time_limit(0);
                    //send the proper header
                    header('Content-Type: text/event-stream');
                    header('Cache-Control: no-cache');
                    if(function_exists('apache_setenv')){
                        @apache_setenv('no-gzip',1);
                    }
                    @ini_set('zlib.output_compression',0);
                    @ini_set('implicit_flush',1);
                    for($i = 0; $i < ob_get_level(); $i++){
                        ob_end_flush();
                    }
                    ob_implicit_flush(1);

                $startedAt = time();

                do {

              $time = time();
              echo "id: $startedAt " . PHP_EOL;
              echo "data: {\n";
              echo "data: \"msg\": \"$time\", \n";
              echo "data: \"id\": $startedAt\n";
              echo "data: }\n";
              echo …
Run Code Online (Sandbox Code Playgroud)

php multithreading server-sent-events

6
推荐指数
1
解决办法
1055
查看次数