Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Senior Member Noteleklabs's Avatar
    Join Date
    Jun 2012
    Location
    NC
    Posts
    217
    Member #
    31890
    Liked
    28 times
    Hey guys! its been a while, anyway I am making a php file explorer, and needed some help with a javascript toggle. Before you cringe at the way I am doing this, keep in mind that I am using twitter bootstrap, and editing that code would mess up other things.

    Now that that is out of the way, I have a link that I want to toggle a form input from hidden, to text, and back when you click it again. (It would be nice if you had it fade away after a couple seconds, as I have jquery on this page) I have my php pre-populating the text fields with what is basicly a link to file, so I just wanna toggle the visibility, but without any display:hidden; or anything
    Thanks for reading this long, and rambly post!
    Hey you! Go make something!

  2.  

  3. #2
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    Code:
    $('element').toggle(function(){
    $('element').show("slow");
    },
    function(){
    $('element').hide("slow");
    });
    This won't be available in jQuery 1.9 for some reason I can't seem to decipher, but that will fade it in and out on click.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  4. #3
    Senior Member Andrew Yurlov's Avatar
    Join Date
    Apr 2011
    Location
    Portland, OR
    Posts
    1,306
    Member #
    27566
    Liked
    181 times
    I recently answered the same question on another thread so I'll do the same code again here.

    You will need a link to serve as your toggle switch

    Code:
    <a href="javascript:toggleDiv('TheDiv');">
    <div id="TheDiv"></div>
    </a>
    and of course the jquery

    Code:
    function toggleDiv(divId) {
    $("#"+divId).slideToggle('fast');
    }
    Is this what you were looking for?
    Artificial intelligence is nothing compared to natural stupidity -Someone

    Design is a funny word. Some people think design means how it looks.
    But of course, if you dig deeper, itís really how it works.
    -Steve Jobs



  5. #4
    Senior Member Noteleklabs's Avatar
    Join Date
    Jun 2012
    Location
    NC
    Posts
    217
    Member #
    31890
    Liked
    28 times
    This
    Quote Originally Posted by Andrew Yurlov, post: 248457
    I recently answered the same question on another thread so I'll do the same code again here.

    You will need a link to serve as your toggle switch

    Code:
    <a href="javascript:toggleDiv('TheDiv');">
    <div id="TheDiv"></div>
    </a>
    and of course the jquery

    Code:
    function toggleDiv(divId) {
    $("#"+divId).slideToggle('fast');
    }
    Is this what you were looking for?
    This is perfect! Thanks!
    Hey you! Go make something!

  6. #5
    Senior Member Andrew Yurlov's Avatar
    Join Date
    Apr 2011
    Location
    Portland, OR
    Posts
    1,306
    Member #
    27566
    Liked
    181 times
    Quote Originally Posted by Noteleklabs, post: 248486
    This
    This is perfect! Thanks!
    No problem. Glad to help.
    Artificial intelligence is nothing compared to natural stupidity -Someone

    Design is a funny word. Some people think design means how it looks.
    But of course, if you dig deeper, itís really how it works.
    -Steve Jobs




Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 02:44 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com