Many links with same jquery animation, how to organize them better?
I have an question about jQuery - I'm working on big system's menu
simulation, so others can play with that and decide, how it should be
better organized - usability and user experience stuff.
Menu is multilevel and every part must be draggable - so it's important (I
guess) to stay all parts in same page. But this not what I want to ask
actually. I have submenu's menu, so it opens using slideToggle() class by
clicking on the menu link.
<script>
$( "#terms" ).click(function() {
$( "#1" ).slideToggle( "slow" );
});
$( "#tc" ).click(function() {
$( "#tc-2" ).slideToggle( "slow" );
});
</script>
I have a lot of that kind of links, so I don't want to write code for
every link, I want to create something like
<script>
$( "a" ).click(function() {
$( "#href" ).slideToggle( "slow" );
});
</script>
So by clicking on the link it opens only this div, which have same id, as
link href.
Sorry for lame question, I really don't know how to explain google what I
want.
No comments:
Post a Comment