Page 2 of 2 FirstFirst 12
Results 16 to 23 of 23

Thread: jQuery - Expanding/Collapsing multiple buttons at once?

  1. #16
    Join Date
    Mar 2005
    Behind you...
    If anything it just makes me more curious. It would appear that the code is being run through with no errors but for some odd reason the line to hide everything is doing nothing. Again, I pulled that directly from the bootstrap documentation on their site so I don't see why it wouldn't work.

    Would you mind moving some things around to test a few more things? I'd suggest changing the declaration of the $showAll variable to 'true' instead of 'false'. This should mean it will first try to collapse/hide first, then expand on the 2nd click. I also wonder what happens if you reverse my if/else statement to check for == false first (the lines inside of each clause need to be switched as well).

    And of course just check the log during your clicks. If still no avail then I'll re-investigate this when I get home. I truly hate being defeated by code
    "Given billions of tries, could a spilled bottle of ink ever fall into the words of Shakespeare?"

  2. #17
    Join Date
    Feb 2014
    Thank you so much for all your help so far, I truly appreciate your time in trying to help me get this working

    I changed the first $showAll to true and the only difference I'm seeing is that instead of saying "true" when I first click it, it start off false now. I tried those other things you suggested and nothing at all seems to change from switching around the first == false check etc. The code I switched it to is below just to be sure I did it right:

    var $showAll = true;
      $('td').addClass('hasRowSpan'); //add class to table rows -- for stopping highlighting
        // if button is clicked, go to next div from that and toggle collapse
    	//button to expand all boxes
    	//.otherbtn is an example of the name of the button
    		if($showAll == false) {
    			$showAll = true;
    		} else {
    			$showAll = false;

  3. #18
    Join Date
    Mar 2005
    Behind you...
    Well after trying to recreate everything locally I realize one major flaw.
    The selector was set to apply to the 'otherbtn' class on any element, not the id. So that line should be:
    If that doesn't fix your issue then I'd have to ask to see your full source just because what i'm working with seems to be missing a lot and it's hard to test it properly.
    "Given billions of tries, could a spilled bottle of ink ever fall into the words of Shakespeare?"

  4. #19
    Join Date
    Feb 2014
    It's almost working thank you!

    It's working correctly on the first click so far, and opens them all, but then doesn't respond when I click it again to try and close them. Any ideas to what could be causing this?

  5. #20
    Join Date
    Feb 2014
    SuperKirby I really appreciate your trying to solve this, thank you

    I'm not sure who this guy above me is who replied with something I said a while ago? Very weird...

    Anyway the reason I took out some text from my code is that since it's for something I'm working on for my company there's a bit or proprietary info and stuff on it. If need be I could try to re-do it so there's a bit more of the content; but I thought the tags and structure of it were really all that was important?

    I just don't get why the hide command doesn't work. It can't be an issue of selecting the right objects because they show correctly, but using hide/toggle just seems to do nothing. I've tried changing it in a bunch of ways and just can't seem to figure it out..

  6. #21
    Join Date
    Mar 2005
    Behind you...
    I only mention it because for instance, I couldn't see that you were originally including bootstrap javascript and so that was something I had to go and include on my own. Little things like that may or may not make a difference. Ultimately I worry that what I'm working with is not what you have.

    My little change from .otherbtn to #otherbtn seemed to solve the hide issue for me, but because my html source is a bit... empty I was noticing some odd behavior with the visibility/overflow of the tables. Meaning, I could see them collapsing but the table itself wasn't hiding the text/content, only reducing its height. This is where I began to wonder if having the actual source vs my mocked up version would help.

    Did you try the swap of .otherbtn to #otherbtn yet?
    "Given billions of tries, could a spilled bottle of ink ever fall into the words of Shakespeare?"

  7. #22
    Join Date
    Feb 2014
    I completely understand what you're saying. If you believe it seems necessary then I may be able to figure out a way for us to take a look at more of the code.

    Sorry I forgot to mention it, but I did already try swapping the . to a # after you first said it and that didn't give me any positive results. It made the button stop working completely, actually. I'm just completely stumped at to how it works correctly in opening, which means the structure of it is correct, but it just doesn't close...

  8. #23
    Join Date
    Feb 2014
    Just wanted to give an update: I managed to "solve" the collapse button issue by making it refresh the page (which always loads collapsed), as opposed to actually collapsing the buttons.

    Thank you for your help Kirby.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.09825 seconds
  • Memory Usage 2,929KB
  • Queries Executed 15 (?)
More Information
Template Usage (36):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (3)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (8)memberaction_dropdown
  • (1)navbar
  • (5)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (74):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • bbcode_parse_start
  • postbit_imicons
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates