Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-11-2007, 04:27 PM
bashy bashy is offline
 
Join Date: Nov 2005
Posts: 2,544
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to make collapse closed by default?

Hi

I have this bit of code, It has a collapse feature and i would like to know how
to set the code so that the box is closed by default please?

Code:
        $nzbfiletable = "<table class=\"tborder\" cellpadding=\"$cellpadding\" cellspacing=\"$cellspacing\" border=\"0\" width=\"100%\" align=\"center\"><td class=\"tcat\" colspan=\"2\"><a style=\"float: right;\" href=\"#top\" onclick=\"return toggle_collapse('nzbfile" . $nzbfileid . "');\"><img id=\"collapseimg_nzbfile" . $nzbfileid . "\" src=\"" . $imgdir_button . "/collapse_tcat.gif\" alt=\"\" border=\"0\"></a>NZB File Contents</td></table>";
        $nzbfiletable .= "<table cellspace=\"1\" style=\"\" id=\"collapseobj_nzbfile" . $nzbfileid . "\"><tr bgcolor=\"#B9CAE6\"><td><font face=\"Verdana\" size=\"1\">Subject</td><td><font face=\"Verdana\" size=\"1\">Group</td><td><font face=\"Verdana\" size=\"1\">Size (kb)</td><td><font face=\"Verdana\" size=\"1\">Parts</td><td><font face=\"Verdana\" size=\"1\">Poster</td></tr>";
Reply With Quote
  #2  
Old 01-11-2007, 07:17 PM
RyanIMC RyanIMC is offline
 
Join Date: Jan 2007
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm also looking for a way to do this

I've seen this,
https://vborg.vbsupport.ru/showthrea...sed+on+default but people without javascript cant reopen the box.

Or you could use this code after the box is created within the template that holds the box.

Code:
<script type="text/javascript">toggle_collapse('IdOfBoxToCollapse')</script>
But if you use that, when you reload the page it simply toggles the box open and closed which is probably also not what people want.

We need a close('IDOfBoxToCollapse')
Reply With Quote
  #3  
Old 01-11-2007, 08:05 PM
BigJohnny's Avatar
BigJohnny BigJohnny is offline
 
Join Date: Jun 2006
Location: Canada
Posts: 500
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

no you just need some code in a template...

Here is one I use, it opens and closes when you click the arrow icon..

Replace all occurances of VARIABLE with whatever variable you choose to name it.

I dont know PHP all too well, so I dont know how you would work this into PHP but im sure you could figure something out.

you can see basically there is a a collapsable table, and the tbody which contains the information to be collapsed.

the rest is just a simple table template basically.... using another "bits" template for the content.

Code:
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%">
	<thead>
		<tr>
		<td class="tcat" colspan="5" align="left" width="100%">
<a style="float:$stylevar[left]" href="#top" onclick="return toggle_collapse('VARIABLE')">Main Header</a>
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('VARIABLE')"><img id="collapseimg_VARIABLE" src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_VARIABLE].gif" alt="" border="0" /></a>
		</td>
		</tr>
	</thead>
	<tbody id="collapseobj_VARIABLE" style="$vbcollapse[collapseobj_VARIABLE]">

			<td class="thead" width="2%" align="left"></td>
			<td class="thead" width="11%" align="left"><b>Title 1</b></td>
			<td class="thead" width="49%" align="left"><b>Title 2</b></td>
			<td class="thead" width="18%" align="left"><b>Title 3</b></td>
			<td class="thead" width="26%" align="left"><b>Title 4</b></td>

		$tablebits
                
	</tbody> 
</table>
<div class="spacer"></div>
<br />
errr... sorry i misread the topic... so i may not have even answered your question... apologies for the wasted space
Reply With Quote
  #4  
Old 01-11-2007, 08:26 PM
bashy bashy is offline
 
Join Date: Nov 2005
Posts: 2,544
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What i am after is having the box closed for default, any ideas, i already have the box and collapse objects
Reply With Quote
  #5  
Old 01-11-2007, 08:28 PM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In your template have it show the collapsed image by default, and also have the box with the following style applied:
Code:
display: none
Reply With Quote
  #6  
Old 01-12-2007, 05:06 AM
bashy bashy is offline
 
Join Date: Nov 2005
Posts: 2,544
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi SirAdrian. The code that i have is in the 1st post, can you please advise where it would go in that code please?
Reply With Quote
  #7  
Old 01-12-2007, 07:47 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Answered
https://vborg.vbsupport.ru/showthread.php?t=136063
Reply With Quote
  #8  
Old 01-12-2007, 03:32 PM
bashy bashy is offline
 
Join Date: Nov 2005
Posts: 2,544
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Cheers dismounted
Reply With Quote
  #9  
Old 11-03-2007, 01:54 AM
reddyink reddyink is offline
 
Join Date: Aug 2007
Posts: 236
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for collapsed style code
I added display:none style in my object. all rows are now collapsed by default. Is there a way that we can set first row to be expanded and all others to be collapsed. then user can click on collapsed one's to expand.

Can we set that option in same box, to first row to be expanded and all others to be collapsed when page loads.

Appreciate any help
Thanks
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:35 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03926 seconds
  • Memory Usage 2,240KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete