Printing MooTools Accordion Items
Sometimes we're presented with unforeseen problems when it comes to our JavaScript effects. In this case, I'm talking about printing jQuery and MooTools accordions. Each "closed" accordion content element has its height set to 0 which means it will be hidden when the user tries to print the page. Luckily MooTools Core Developer Thomas Aylott provides a simple fix.
The CSS Fix
@media print {
.element { height:auto !important; }
}
That's it -- no joke. Setting a print-specific height of auto with the ever-useful !important declaration fixes everything.
Big ups to @subtlegradient for the solution. Another reason I'm so happy to be surrounded by clever developers.
When you say or read "HTML5", you half expect exotic dancers and unicorns to walk into the room to the tune of "I'm Sexy and I Know It." Can you blame us though? We watched the fundamental APIs stagnate for so long that a basic feature...
Your early CSS books were instrumental in pushing my love for front end technologies. What was it about CSS that you fell in love with and drove you to write about it?
At first blush, it was the simplicity of it as compared to the table-and-spacer...
A few weeks back, jQuery expert Janko Jovanovic dropped a sweet tutorial showing you how to create a Skype-like button using jQuery. I was impressed by Janko's article so I decided to port the effect to MooTools.
The XHTML
This is the exact code provided by...
One subtle detail that can make a big difference on any web design is the use of image reflections. Using them too often can become obnoxious but using reflections on large, "masthead" images is a classy enhancement. Unfortunately creating image reflections within your...
wow… that is really enlightening. thanks for sharing
I tell you what, i don’t have a use for this right now, but it’s one of those things that will undoubtably drive me crazy in the future. Very nice dude, i’ll keep it mind.
Thanks for posting about print stylesheets – they are something which are all too often overlooked, but a very important part of web development in my opinion.
So simple… Thanks for the tips.
should also work
I’ve recently run up against this problem. The script provided works fine, but as far as I can tell, you can’t use the opacity effect with the accordion.
I’ve added:
To my print css, but it doesn’t fix the problem. If anybody knows of a solution, then I’m certainly listening. :)
(Accordion mootools)…can be linked to any part of which is not active? How? I thank you in advance
@David: The same problem. Height:auto works but no text is show.
Thanks for this was bugging me for ages. The text was disappearing for me too but the “display:inline !important” seems to fix it (Thanks to Gui).
Saf
Neither of the fixes presented here have worked for me. Only the section headline shows up on print.
If anyone still comes across this problem: only the following code helped me (jQuery Accordion):
.ce_accordion { display: block !important; height: auto !important; }