开发者

how can i control jquery UI Accordian with external anchor or button

How can I control jQuery UI Accordion with external anchor or button?

Suppose I开发者_如何学运维 use:

<script>
 $function(){
$("#accordion").accordion({
    header: "h3",
    autoHeight: false,
    navigation: true
    });
});  
</script>

With this HTML:

    <div id="accordion">

<div>
<h3><a href="#"><b>tab1</b></a></h3>
    <div>
    <p>Some text here 1</p>
     </div>
</div>

<div>
     <h3><a href="#"><b>tab 2</b></a></h3>
<div>
     <p>some text here 2</p> 
     </div>
</div>

</div>

How can I control or trigger or open these with external anchor or button?


Change this,

<h3><a href="#"><b>tab 2</b></a></h3>

to,

<h3><a name="tab2" href="#tab2"><b>tab 2</b></a></h3>

Then code your link like this:

<a href="http://domain.com/page/#tab2">Click here to see Tab 2</a>

I've just done this on a site today. The problem I'm having is that the page links to the correct anchor point and then opens the accordian, meaning the user is no longer at the correct anchor point.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜