开发者

How to show the DIV related with clicked link and hide other DIVs with Jquery?

As I summarized at topic I want to show the DIV related with clicked link and hide other DIVs with Jquery. To be able to understand what I am saying, please visit Worldlines

You will see there the topics related with some news. When somebody clicked on a topic the news div will slide-down below cl开发者_开发知识库icked topic and previously read news div will hide.

I think I told what I want clearly.

Thank you,


You'll add a script at the beginning of your html like so:

<script type="text/javascript" src="/jquery-1.4.1.min.js"></script> 
<script type="text/javascript">

    function showPanel2() {
    $('#Panel1').hide();
    $('#Panel2').show();
    }

</script>

This will hide one panel and show another. The "Panel1" and "Panel2" are simply the IDs of the panels you'll be showing or hiding. And then you'll have the following code on your button:

 <input type="button" onclick="showPanel2();" value="Submit" />

This should be simple enough to modify if you want to hide multiple panels.


Jquery Accordion was what I look for. You can find it here http://jqueryui.com/demos/accordion/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜