简体   繁体   English

显示和隐藏Javascript(显示:无)问题

[英]show and hide Javascript (display:none) issue

I have created a show/hide javascript function which seems to work perfectly - When you click on the link it reveals the gif version of the logo. 我创建了一个显示/隐藏javascript函数,它似乎完美无缺 - 当你点击链接时,它会显示徽标的gif版本。

The issue i'm having is when you first go onto the landing page click here you can see both images, it's only when you click on the still image the function works the way is should - only displaying one image at a time. 我遇到的问题是,当你第一次进入登陆页面时, 点击这里你可以看到两个图像,只有当你点击静止图像时,功能才能正常工作 - 一次只显示一个图像。 Does anyone know how i can resolve this problem? 有谁知道我怎么能解决这个问题?

你必须给图像一个display:none样式也可以开始:

<img id="center-img-gif" alt="main-img" src="css/images/logo.gif" style="display:none;">

use CSS property Display:none; 使用CSS属性Display:none; for one of the images. 对于其中一个图像。

您可以设置display:none在设计时一个图像,或者你可以设置display:none一个图像对body onload

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

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