简体   繁体   English

将鼠标悬停在TEXTAREA或A对象上时会出现奇怪的CSS / JavaScript行为

[英]strange CSS / Javascript behavior when hovering over TEXTAREA or A objects

I have a strange problem in my web-app (php) that I noticed recently. 我在最近注意到的网络应用程序(php)中遇到一个奇怪的问题。 1 month ago it worked just fine. 1个月前,它工作得很好。

When I hover above a certain < TEXTAREA > or over 2 buttons (add, exit), in a DIV, the DIV gets filled with its background color, making the INPUT, TEXTAREA and 2 buttons invisible. 当我将鼠标悬停在某个<TEXTAREA>上方或超过2个按钮(添加,退出)时,在DIV中,DIV会填充其背景颜色,从而使INPUT,TEXTAREA和2​​个按钮不可见。

This DIV is practically a window with 2 inputs and an OK and exit button, that I hide and show, as a "window" thing would be in Windows. 这个DIV实际上是一个具有2个输入以及一个“确定”和“退出”按钮的窗口,我将其隐藏并显示为Windows中的“窗口”。

The moment I hover any other button in the page (so I do a mouseOver), the DIV shows up again, and it starts working the proper way. 当我将鼠标悬停在页面中的任何其他按钮上时(因此我做了mouseOver),DIV再次显示,并且它以正确的方式开始工作。

So the problem is when i hover on the TEXTAREA and the 2 buttons, the DIV gets gray. 所以问题是当我将鼠标悬停在TEXTAREA和2​​个按钮上时,DIV变灰。

thanks! 谢谢!

i hope it's not a Chrome bug, in Firefox it seems to work, but again in Opera it doesn't. 我希望它不是Chrome的错误,在Firefox中似乎可以正常工作,但在Opera中则不能。 So strange. 这么奇怪。

took at look at your site in Chrome and was able to replicate your problem easily. 在Chrome浏览器中查看了您的网站,并能够轻松地复制您的问题。

by using the "Element Inspector" i removed overflow:hidden from .my_links_header_container and could no longer replicate the problem. 通过使用“元素检查器”,我从.my_links_header_container删除了overflow:hidden ,并不再能够复制该问题。

i tested it several times by reloading the page. 我通过重新加载页面对其进行了多次测试。

on page load, the problem existed, but immediately. 在页面加载时,问题就存在了,但立即出现了。 after i removed the overflow:hidden , it 100% did not occur again. 我删除了overflow:hidden ,它100%不再发生。

on a side note, you have an inline style="display:block" on your .add_link_table , which is not really a table element but a div . 另外,您在.add_link_table上有一个内联style="display:block" ,它实际上不是一个table元素,而是一个div that's redundant because a div is a block element by nature -- perhaps it was a table element previously? 这是多余的,因为div本质上是一个块元素-也许以前是一个table元素?

i also noticed several elements whose natural display was overridden by your CSS. 我还注意到了一些自然显示被CSS覆盖的元素。 i think part of this problem is related to flip-flopping your elements and displays. 我认为此问题的一部分与翻转您的元素和显示有关。

Seems to be a webkit issue. 似乎是一个Webkit问题。

This may not be a good solution, but give it a try I am modifying you addLink method (use plain javascript or jquery selectors as you like, Ive kept the original code as it is) 这可能不是一个好的解决方案,但请尝试一下,我正在修改您的addLink方法(根据需要使用普通的javascript或jquery选择器,我将原始代码保持原样)

function addLink()
{
 var addLinkTable = $("#add_link_table");
    if(document.getElementById('add_link_table').style.display=='block')
    {
        document.getElementById('add_link_table').style.display = 'none';
    }else{
        addLinkTable.css("visibility","hidden");
        document.getElementById('add_link_table').style.display ='block';
        setTimeout(showTable,10);
        function showTable(){
           addLinkTable.css("visibility","visible");
         }
    }
    document.getElementById('link_name').focus();
}

Try it out with by switching visibility or opacity or height 通过切换可见性,不透明度或高度来尝试一下

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

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