开发者

Multiple href ids

I'm using two jquery plugins:

scrollto and fading-tabs

both of them activate the function via the href attribute (href="#some-id")

How can i a开发者_Python百科ctivate two ids in href on the same time? like:

href="#some-id1,#some-id2"


You should attach to the click event handler yourself and invoke the specific methods you want instead of letting each plugin do it:

$('#myLink').unbind().click(function()
{
     var href = this.href;

     // Invoke other methods as you want here

     $(this).scrollto(/* Something with href.split(',')[0] */);
     $(this).fadingTabs(/* Something with href.split(',')[1] */);
});


You cannot do this. May be you can have 2 elements close to each other and set the href to these elements and then call the plugin on both of these elements.


I think a better solution would be to switch these to classes such as:

class="some-id1 some-id2"

Then do something like the following with your jQuery:

$(".some-id1").scroll....

$(".some-id2").fade....


Didn't find a solution for solving the two hrefs. But for anybody who have tried to do the same thing:

have a tab switch and make the link scroll to the tab-container.

I solved the problem by building my own tab script with jquery and activating the tab by javacript through click function and then use .scrollTo as normal

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜