javascript - Jquery accordion menu built using tables -
Says the same as the title ... I need help creating a better edarian menu with jquery animation. However, the menu is created using the table and I do not have access to HTML. Even so far I have this, but I am not happy with the result (it is very jerky).
jq16 = jQuery.noConflict (true); Jq16 (document) .ready (function () {jq16 ("td.categorySidebar table tr"). Each (function () {// IE fix - get all tr and rebuild it at the end of the table jq16 (this) .appendTo ("Td.categorySidebar table tbody"); // Get all level 1 TD if (jq16 (this). Child (). HasClass ('categorySidebarLabelLevel1')) {// Add the same TD class in the original TR and show ceremony Apply jq16 (this) .addClass (jq16 (this). Children (). Add hover to level ('square'); // level 1 tr jq16 (this). (Function () (if (jq16 (this). HasClass ('categorySidebarLabelSelected') || jq16 ('& gt; TD Table Tia T.D., this.) Haas class ('category sidebar label selected') {return false;} other {jq16 ('& gt; TD table', this). Stop (true, true). Toggle ();} }};}}); // What is selected to show / hide the sub-layout Ls and / / jq16 ("td.categorySidebar table tr [class ^ = 'categorySidebarLabelLevel1']") on the document load build table Check for .each (function (k, v) {// sub-tiers wrap the table and hide sub subcat = jq16 (this) .nextUntil ("[class ^ = 'categorySidebarLabelLevel1']"). WrapAll ('& lt; Table style = "Display: none;" & gt; & lt; cube & gt; & lt; / tbody & gt; & lt; / table & gt;';); // Adding sub-levels to level 1 TD so that we can apply the hover function jq16 (subcut). Parent (). mother-father (). Appendo (jq16 (this). Child ('TD')); // Check Level 1 to see if this (jq16 (this) .hasClass ('categorySidebarLabelSelected')) {jq16 (this). } // Check to see if each sub-level is whether it is jq16 (subCat) .each (function () (if (jq16 (this). Child () .hackle ('categorySidebarLabelSelected')) {jq16 (this). Parent () .Parent (). Show ();}}};}); }); You can get the accordion effect with CSS transition:
table, tr, td {display: block; } Table table table {max height: 0; Hidden flurry; -Widk-Infection: Maximum-height 0.8 s; -MOZ-infection: Maximum-height 0.8 s; Transition: Maximum-height 0.8 s; } Table.open {Max-height: 200px; / * The largest sub-table * /} and toggleclass:
should be longer than jq16 ('TD table', this). ToggleClass ('open');
Comments
Post a Comment