[jQuery] Re: Multiple lists that should only show x amount of items until you expand them
I'm starting to think that this is not possible without having different names/classes on the different menus which makes it hard since they are generated form a resultset. On Mar 24, 8:18 pm, Jens Bengtsson poserdo...@gmail.com wrote: OK, this is what I have. Multiple lists that I can collapse and expand. What I want is for them to only show x amount of items until I expand them. Say x = 2 In Section A the following would be shown Link A-A Link A-B In Section B the following would be shown Link B-A Link B-B etc. And when I push a Section link it will show all html head script type=text/javascript src=jquery.js/script script type=text/javascript $(document).ready(function() { $(#menu li a[class=expanded] + ul).slideToggle(medium); $(#menu li a).click(function() { $(this).toggleClass(expanded).toggleClass(collapsed).find(+ ul).slideToggle(medium); }); }); /script /head body ul id=menu lia class=expandedSection A/a ul lia href=#Link A-A/a/li lia href=#Link A-B/a/li lia href=#Link A-C/a/li lia href=#Link A-D/a/li /ul /li lia class=expandedSection B/a ul lia href=#Link B-A/a/li lia href=#Link B-B/a/li lia href=#Link B-C/a/li lia href=#Link B-D/a/li /ul /li lia class=expandedSection C/a ul lia href=#Link C-A/a/li lia href=#Link C-B/a/li lia href=#Link C-C/a/li lia href=#Link C-D/a/li /ul /li /ul /body /html
[jQuery] Want to pass a variable to the selector
This is my HTML liaDOCUMENT/LAROSATE/a (1) ul lia href=/Default.aspx?q=*amp;navigator=DOCUMENT/LAROSATE:0XD6 VRIGT0XD6 VRIGT/a (20)/li /ul ul id=DOCUMENT/LAROSATE_more lia href=javascript:toggle('DOCUMENT/ LAROSATE_more');Show less/a/li /ul /li This is my javascript function toggle(id) { $(#+id).slideToggle(fast); } id is passed in as DOCUMENT/LAROSATE_more but the selector doesn't work, there is no toggle. What could be wrong?
[jQuery] Re: Want to pass a variable to the selector
Found the problem, you can't use / in the name. On Mar 25, 1:28 pm, Jens Bengtsson poserdo...@gmail.com wrote: This is my HTML liaDOCUMENT/LAROSATE/a (1) ul lia href=/Default.aspx?q=*amp;navigator=DOCUMENT/LAROSATE:0XD6 VRIGT0XD6 VRIGT/a (20)/li /ul ul id=DOCUMENT/LAROSATE_more lia href=javascript:toggle('DOCUMENT/ LAROSATE_more');Show less/a/li /ul /li This is my javascript function toggle(id) { $(#+id).slideToggle(fast); } id is passed in as DOCUMENT/LAROSATE_more but the selector doesn't work, there is no toggle. What could be wrong?
[jQuery] Multiple lists that should only show x amount of items until you expand them
OK, this is what I have. Multiple lists that I can collapse and expand. What I want is for them to only show x amount of items until I expand them. Say x = 2 In Section A the following would be shown Link A-A Link A-B In Section B the following would be shown Link B-A Link B-B etc. And when I push a Section link it will show all html head script type=text/javascript src=jquery.js/script script type=text/javascript $(document).ready(function() { $(#menu li a[class=expanded] + ul).slideToggle(medium); $(#menu li a).click(function() { $(this).toggleClass(expanded).toggleClass(collapsed).find(+ ul).slideToggle(medium); }); }); /script /head body ul id=menu lia class=expandedSection A/a ul lia href=#Link A-A/a/li lia href=#Link A-B/a/li lia href=#Link A-C/a/li lia href=#Link A-D/a/li /ul /li lia class=expandedSection B/a ul lia href=#Link B-A/a/li lia href=#Link B-B/a/li lia href=#Link B-C/a/li lia href=#Link B-D/a/li /ul /li lia class=expandedSection C/a ul lia href=#Link C-A/a/li lia href=#Link C-B/a/li lia href=#Link C-C/a/li lia href=#Link C-D/a/li /ul /li /ul /body /html