I want to display some text in UIWebView with boxes that can be expanded or collapsed. The box has the title in it, and when tapping the bar of the collapsed box, it expands. I guess there's already some cool solution for this that could be easily incorporated into an local UIWebView html file?
A:
Almost all JavaScript UI frameworks support this out of the box. I prefer jQuery.
If you want to do this yourself, all you have to do is to put the content of the box in a block element (say, a div
) and then toggle the display
style between ""
and "none"
:
el.style.display = (el.style.display != 'none' ? 'none' : '' );
Aaron Digulla
2010-09-28 07:44:40