I’m using jQuery’s slideToggle() function to control the expand/collapse feature of my website. Currently, I only have one page which has been developed upon before I implement it across the site; here it is.
By default, jQuery slideToggle() uses display=”block” which isn’t helping me. I’d like to make it use display=”inline-table” instead when a panel is expanded, and revert back to display=”none” when the same panel is collapsed.
There are a few settings I’ve applied to the CSS to make sure that the layout is how I want it to be:
.specs {
width: 930px;
height: 100px;
border: none;
color: #ffffff;
font-weight: normal;
display: none;
}
The height property is used to ensure that all of the icons within the panels are fully viewable. Removing this will cause smaller panels like ‘Memory’ to cut off half of the icon.
While collapsed, the panels are set to display=”none” to make sure they don’t affect the layout. However, upon expanding, they need to be set to display=”inline-table” to bypass some alignment issues which you can currently see when looking at panels like ‘Web Browsing’ and ‘Rear Camera’ (basically, the lists overlap the DIVs below, and the inline-table setting fixes that).
As soon as I’m able to fix this issue, I can move on to implement this design into other pages.
P.S. – Currently in use, is Redsquare’s method, so expanding is fine, but they don’t want to collapse.
Thank you,
Dylan.
This seems to work for me. Use
min-heightinstead ofheightUPDATE: See it in action at http://jsfiddle.net/LLQyV/1/
Try this. Remove min-height from the CSS.
In your HTML enclose each spec in a div classed as toggleContainer like so (I duplicated your general category and added various specs to each one.)
Then in your JS file do this (I combined all your onclick=’toggle’ calls into this)