Results 1 to 2 of 2

Thread: Hotkey to Expand/Contract

  1. #1
    Join Date
    Apr 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Hotkey to Expand/Contract

    Greetings,
    I am using this script:

    http://www.dynamicdrive.com/dynamici...tchcontent.htm

    I would like to be able to press "c" on my keyboard and all the switch content contracts.

    How would I implement such things into my script to get it to work?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Put his in the head after the call to the switchcontent.js file.

    Code:
    <script type="text/javascript">
    document.onkeydown=function(e){
    var e=window.event? window.event : e;
    if(e.keyCode=="C".charCodeAt(0))
    bobexample.sweepToggle('contract')
    else if(e.keyCode=="E".charCodeAt(0))
    bobexample.sweepToggle('expand')
    }
    </script>
    bobexample (here from the demo markup) refers to the switchcontent instance.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •