Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Javascript Overlay - Jquery

  • 27-03-2009 02:39PM
    #1
    Registered Users, Registered Users 2 Posts: 123 ✭✭


    Hi,

    I'd like to get an overlay working on a webpage.

    I have been able to install jquery overlay on the page and can get it to work when a button is clicked, what I want to do is get it to open when the page loads.

    I have tried putting the relative function in the body:
    <body onLoad="openOverlay()"> to no avail

    I also tried calling it after the function has been declared to no avail,
    Did the same within the body of the html.

    here are the two functions that can trigger the box:

    $(function() {
    $("button[rel]").overlay();
    });

    The button that opens this:
    <button type="button" rel="#overlay">Open overlay</button>

    function openOverlay() {

    // get access to the overlay API
    var api = $("#overlay").overlay();

    // call it's open() method
    api.load();
    }


    The button that opens this:
    <button type="button" onClick="openOverlay()">Open overlay</button>

    I would like either of those functions to be triggered when the page loads/opens.

    Can this be done in the HTML or is it something that I would need to add intot the attached javascript (jquery_002.js and jquery.js)

    Any suggestions appreciated
    If you need any further information please let me know.

    Here is the site that has it:

    http://flowplayer.org/tools/archive/overlay-0.14.html


Comments

  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    Firstly, make sure openOverlay is defined before it's referenced (but after its JavaScript/include files

    Secondly, add openOverlay() to a jQuery $(document).ready() function


Advertisement