jQuery show / hide切换仅在大屏幕尺寸时触发

时间:2019-10-04 14:09:40

标签: javascript jquery

URL为http://zacimoveis.vistatemporario.com.br/nossa-equipe

问题在于悬停图像时显示的蓝色说明框。它适用于大于980像素的屏幕,但在<980像素的屏幕上无任何作用,无论是在平板电脑/手机还是台式机上。

我已经尝试过toggle(),slideToggle()以及将show()和hide()向上对齐,然后搜索大量的不同版本。

这是脚本的当前版本:

$(document).ready(function() { $(".membro").hover(function() {
var pessoa = $(this).attr('id');
$('#txt' + pessoa).toggle()
})});

(控制台中不会显示错误消息。)

1 个答案:

答案 0 :(得分:0)

认为此事件是问题所在,您正在使用.hover。别认为这可以在您的桌子/电话等上正常工作。事实上,我记得在平板电脑/手机上没有.hover。

您可能需要按照

的方式进行操作
test_string = "Hello! This is a test. I love to eat apples."

fruits = ['apples', 'oranges', 'bananas'] 

for fruit in fruits:
    if fruit in test_string:
        print(fruit+" contains in the string")

或者您可能需要添加更多CSS类。引导方法之后似乎有一个网格系统,这可能也会干扰您的定位。