![]() I'd like the change show and hide to remove or add this class, instead of directly changing the display attribute, so that if you add the hidden class and then remove it again (ie hide and show something) then it's back to exactly how it was to start off with (since adding a class overrides the attributes rather than directly changing them). in your web pages by giving a switchable option. ![]() Use toggle method if you need to allow users show or hide any elements like div, menu, paragraphs etc. On second click, the sidebar may reappear to the previous position and div B should shrink back to the previous width. You should select by an id or name instead of the nth element like I do. In my code, whenever i want something to be hidden initially i give it a class 'hidden'. The toggle method The toggle method of jQuery will hide specified visible element and display the hidden elements. On the toggle button click, the sidebar may hide to the left and div B should stretch to fill the empty space. You can use toggle to show / hide an element. I've used jquery's show() and hide() functions extensively in my code and just encountered a bit of a problem: they work by changing the display attribute of the element to 'block' or 'none' respectively, so that if you have somethin that has display: inline and then hide and show it, you've changed its display to block, which screws up the layout in a couple of cases.
0 Comments
Leave a Reply. |