www.webdeveloper.com
Results 1 to 3 of 3

Thread: Trying to get an image to load when page loads

  1. #1
    Join Date
    Feb 2011
    Posts
    13

    Trying to get an image to load when page loads

    Hello,

    I'm trying to get this image to pop up when the page loads. It's JQuery (it's already loaded on my server so I don't have to place it in the script

    Anyway, I'm stuck. Do I need to add a div within the body? Or is there something else I need to do. Thanks

    Code:
    <link rel="stylesheet" type="text/css" href="shadowbox.css">
    <script type="text/javascript" src="shadowbox.js"></script>
    <script type="text/javascript">
    Shadowbox.init({
        skipSetup: true
    });
    
    window.onload = function() {
    
        Shadowbox.open({
            content:    '<img alt="lightbox1 (155K)" src="lightbox1.jpg" height="317" width="625" />',
            player:     "html",
            title:      "Lightbox",
            height:     350,
            width:      650
        });
    
    };
    </script>
    </head>
    <body>
    </body>
    <html>

  2. #2
    Join Date
    Feb 2011
    Posts
    5

    loading

    I don't know too much about this vut you can try:

    <script type="text/javascript">

    function loader(){
    document.getElementById("id1");
    }

    window.onload=loader();

    </script>

    </head>
    <body >
    <span id=id1>
    <img alt="lightbox1 (155K)" src="lightbox1.jpg" height="317" width="625" />
    </span>

    </body>

  3. #3
    Join Date
    Nov 2010
    Location
    Los Angeles, CA
    Posts
    234
    what do you mean jQuery is loaded on your server? A script tag for jQuery needs to be present on any page using the library.

    Are you sure you don't need to place your code inside $(document).ready()?

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



Recent Articles