Results 1 to 4 of 4

Thread: show a div onload and hide it few seconds

  1. #1
    Join Date
    May 2013
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default show a div onload and hide it few seconds

    How can i show a div onload and hide it in few seconds. Can you please help me out

    developerhusain

  2. #2
    Join Date
    Mar 2011
    Location
    N 11 19' 0.0012 E 142 15' 0
    Posts
    1,524
    Thanks
    41
    Thanked 89 Times in 88 Posts
    Blog Entries
    3

    Default

    Code:
    $(function() {
        	$("#testdiv").delay(2000).fadeOut(0);
    });
    Example:

    HTML Code:
    <!DOCTYPE html>
    <html>
    <head>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
    <script type="text/javascript">
    	$(function() {
        		$("#testdiv").delay(2000).fadeOut(0);
    	});
    </script>
    </head>
    <body>
    <div id="testdiv">Test</div>
    </body>
    </html>
    In testing I used a local copy of jQuery because the google hosted version wasn't working for some reason.

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,072
    Thanks
    44
    Thanked 3,216 Times in 3,178 Posts
    Blog Entries
    12

    Default

    You might want something more elaborate, like:

    http://www.dynamicdrive.com/dynamici...stickynote.htm
    - John
    ________________________

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

  4. The Following User Says Thank You to jscheuer1 For This Useful Post:

    developerhusain (05-25-2013)

  5. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,072
    Thanks
    44
    Thanked 3,216 Times in 3,178 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by keyboard1333 View Post
    In testing I used a local copy of jQuery because the google hosted version wasn't working for some reason.
    If you use the URL to the Google hosted jQuery without the protocol:

    Code:
    <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
    the page must be live. For local testing you can use:

    Code:
    <script src="http//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
    Right now Google is hosting that version. But you also have to make sure they are hosting any particular version you want before relying upon them for it.

    As far as I can tell, they are not currently hosting 2.0.1, which is the latest, nor 1.10.0, both of which are available on the jQuery home page.

    Interestingly though jQuery is now offering both 2.0.1 and 1.10.0 for download, on their api docs page and home page, they're still using 1.9.1.

    This is a lot of versions and a lot of changes all at once, even for jQuery. I think that they're moving a little too fast, or should have just waited till version 2 to make so many changes and skipped 1.9+ in the 1 series. But it's up to them what they want to do. Hopefully once the transition to version 2 is well established, the dust will settle to a certain extent.
    - John
    ________________________

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

Similar Threads

  1. show link after x seconds+grab link
    By biso911 in forum Looking for such a script or service
    Replies: 0
    Last Post: 12-18-2009, 06:38 PM
  2. Show and Hide in php
    By MSK7 in forum PHP
    Replies: 5
    Last Post: 02-04-2009, 10:58 AM
  3. Replies: 5
    Last Post: 10-25-2008, 09:15 PM
  4. Replies: 3
    Last Post: 07-30-2008, 12:53 PM
  5. show hide div (hide last open div)
    By flash in forum JavaScript
    Replies: 5
    Last Post: 12-24-2007, 07:57 PM

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
  •