don4g Posted May 1, 2008 Share Posted May 1, 2008 Hey, Im new to PHP and im tryin to figure out how to make those sections where you can minimize them or expand them like they have on facebook.com. I dont even know the correct term for it anythign would help. All info i find on the subject is for java but i have been working in php and im pretty sure facebook does it with php. any help would be greatly appreciated thanks, donny Link to comment https://forums.phpfreaks.com/topic/103732-collapsable-and-expandable-sections-like-facebook/ Share on other sites More sharing options...
947740 Posted May 1, 2008 Share Posted May 1, 2008 You could use a combination of javascript, <div> tags, and PHP. Link to comment https://forums.phpfreaks.com/topic/103732-collapsable-and-expandable-sections-like-facebook/#findComment-531116 Share on other sites More sharing options...
benphp Posted May 1, 2008 Share Posted May 1, 2008 Javascript: <script language=javascript type='text/javascript'> function hideDiv() { if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById('hideshow').style.visibility = 'hidden'; } else { if (document.layers) { // Netscape 4 document.hideshow.visibility = 'hidden'; } else { // IE 4 document.all.hideshow.style.visibility = 'hidden'; } } } function showDiv() { if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById('hideshow').style.visibility = 'visible'; } else { if (document.layers) { // Netscape 4 document.hideshow.visibility = 'visible'; } else { // IE 4 document.all.hideshow.style.visibility = 'visible'; } } } </script> As you can see it gets the div ID for each of the browsers and hides it or shows it. I named the Div Id hideshow to make it easy for you. Then in your document put in your Div element the id name hideshow you can change this of course <div id="hideshow" ..etc> My content </div> and this to call the javascript to hide it <a href="javascript:hideDiv()">hide Div</a> and this to show it <a href="javascript:showDiv()">show Div</a> Link to comment https://forums.phpfreaks.com/topic/103732-collapsable-and-expandable-sections-like-facebook/#findComment-531121 Share on other sites More sharing options...
don4g Posted May 2, 2008 Author Share Posted May 2, 2008 thanks so much for the help. it took me a bit to figure out what to do with the script... its so true the more you know... the more you dont know... thanks again Link to comment https://forums.phpfreaks.com/topic/103732-collapsable-and-expandable-sections-like-facebook/#findComment-531378 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.