显示/隐藏div问题 [英] show/hide div problem

查看:75
本文介绍了显示/隐藏div问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此代码来显示和隐藏div。

I''m using this code to show and hide a div.


展开 | 选择 | 换行 | 行号

推荐答案

经过花费大量时间试图找出问题之后,我想通了。我所要做的就是在href =
Well after spending a ridiculous amount of time trying to figure out the problem, I figured it out. All I had to do was add an # to the href=


中添加一个#,你需要让事件处理函数返回false。


取消点击的默认操作,即导航到href属性中的页面。将值设置为#只会强制页面跳转到顶部。
You need for your event handler functions to return false.

That cancels the default action of the click, which is to navigate to the page in the href attribute. Setting the value to be "#" will only force the page to jump to the top.


感谢您的回复。如果你的意思是跳到顶部使div显而易见,这就是我想要的。无论如何,它现在有效,我所做的就是添加#。


谢谢
Thanks for the reply. If what you mean by "jump to the top" is making the div visible, that is what I wanted. Regardless, it works now and all I did was add the #.

thanks


这篇关于显示/隐藏div问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆