SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Guru GamerZ's Avatar
    Join Date
    Nov 2001
    Location
    Singapore
    Posts
    617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Docking Boxes (DBX) Close/Open All Boxes

    Does anyone of you guys uses Docking Boxes (DBX) (http://www.brothercake.com/site/resources/scripts/dbx/) I am fguring out how to Close/Open All Boxes with the click on a button. Can't seem to get it right.

    Any ideas?

  2. #2
    SitePoint Guru GamerZ's Avatar
    Join Date
    Nov 2001
    Location
    Singapore
    Posts
    617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmmm sorry to bum this thread, no one?

  3. #3
    SitePoint Guru
    Join Date
    Mar 2004
    Location
    Earth
    Posts
    406
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Remote calls aren't available in this version (they will be in v3, but I don't know when that will be released..)

    What you could do at a pinch is iterate through the <a> elements inside the dbx-group container, get all of those that have "dbx-toggle" in their class name but not "dbx-toggle-closed" (which are toggle button objects, relating to boxes that are not already closed), and then use the click() method on them.

  4. #4
    SitePoint Guru GamerZ's Avatar
    Join Date
    Nov 2001
    Location
    Singapore
    Posts
    617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi brothercake

    Didn't know you are a staff here, just want to say, excellent script there.

  5. #5
    SitePoint Guru GamerZ's Avatar
    Join Date
    Nov 2001
    Location
    Singapore
    Posts
    617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I got the following function
    Code:
    function dbx_open_boxes() {
    	menu_container = document.getElementById('Menu');
    	menu_container_a = menu_container.getElementsByTagName('a');
    	for(i = 0; i < menu_container_a.length; i++) {
    		if(menu_container_a[i].className == 'dbx-toggle dbx-toggle-closed') {
    			menu_container_a[i].click();
    		}
    	}
    }
    But firefox error console is telling me "menu_container_a[i].click is not a function"

  6. #6
    SitePoint Guru GamerZ's Avatar
    Join Date
    Nov 2001
    Location
    Singapore
    Posts
    617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I found another way to do it, but no idea whether it is the right way.

    Code:
    // Init DBX Key
    var menu_manager;
    var menu;
    function dbx_key_init() {
    	menu_manager = new dbxManager('menu');
    	menu = new dbxGroup(
    		'Menu', 		// container ID [/-_a-zA-Z0-9/]
    		'vertical', 		// orientation ['vertical'|'horizontal']
    		'10', 			// drag threshold ['n' pixels]
    		'no',			// restrict drag movement to container axis ['yes'|'no']
    		'10', 			// animate re-ordering [frames per transition, or '0' for no effect]
    		'yes', 			// include open/close toggle buttons ['yes'|'no']
    		'open', 		// default state ['open'|'closed']
    		'Maximize', 		// word for "open", as in "open this box"
    		'Minimize', 		// word for "close", as in "close this box"
    		'Click And Drag To Move This Box', // sentence for "move this box" by mouse
    		'Click To &#37;toggle% This Box', // pattern-match sentence for "(open|close) this box" by mouse
    		'Use The Arrow Keys To Move This Box', // sentence for "move this box" by keyboard
    		', Or Press The ENTER Key To %toggle% It',  // pattern-match sentence-fragment for "(open|close) this box" by keyboard
    		'%mytitle%  [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
    		);
    }
    
    // Add Load Event
    addLoadEvent = function(f) { var old = window.onload
    if (typeof old != 'function') window.onload = f
    else { window.onload = function() { old(); f() }}
    }
    addLoadEvent(dbx_key_init);
    
    // DBX - Open All Boxes
    function dbx_open_boxes() {
    	is_all_open = true;
    	menu_container = document.getElementById('Menu');
    	menu_container_a = menu_container.getElementsByTagName('a');
    	for(i = 0; i < menu_container_a.length; i++) {
    		if(/dbx\-toggle\-closed/.test(menu_container_a[i].className)) {
    			menu.toggleBoxState(menu_container_a[i], true);
    			is_all_open = false;
    		}
    	}
    	if(is_all_open) {
    		alert("All menu boxes are already opened.");
    	}
    }
    
    // DBX - Close All Boxes
    function dbx_close_boxes() {
    	menu_container = document.getElementById('Menu');
    	menu_container_a = menu_container.getElementsByTagName('a');
    	for(i = 0; i < menu_container_a.length; i++) {
    		if(/dbx\-toggle\-open/.test(menu_container_a[i].className)) {
    			menu.toggleBoxState(menu_container_a[i], true);
    		}
    	}
    }


Bookmarks

Posting Permissions

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