SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thickbox from onload

    Im trying to load the thickbox tied at onload event, but what i got is only the opacity property applied and the box itself doesnt appear.

    Im checking for double or more group permission from user session info and in case i found it, im inserting an include file on page that calls the thickbox, like below:

    <script type="text/javascript" src="jquery-latest.js"></script>
    <script type="text/javascript" src="thickbox.js"></script>
    <script type="text/javascript" src="thickbox.css"> </script>
    <link rel="stylesheet" href="thickbox.css" type="text/css" media="screen" />

    <script language="JavaScript">
    function showBox(){
    var a = document.getElementById('link');
    var t = a.title || a.name || null;
    var l = a.href || a.alt;
    var g = a.rel || false;
    tb_show(t,l,g);

    }


    </script>
    <link rel="stylesheet" href="thickbox.css" type="text/css" media="screen" />
    </head>

    <body onLoad="showBox();">
    <a href="group_multiple.asp?keepThis=true&TB_iframe=true&height=380&width=380" title="Multiple group" class="thickbox" id="link">Test</a>

    </body>

    The page is included and I can see the " Test " href, but nothing from thickbox to be shown..

    If I press the href link, the box opens perfectly..

  2. #2
    SitePoint Evangelist bradical1379's Avatar
    Join Date
    Feb 2007
    Posts
    442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mjunior View Post
    I&#180;m trying to load the thickbox tied at onload event, but what i got is only the opacity property applied and the box itself doesn&#180;t appear.

    I&#180;m checking for double or more group permission from user session info and in case i found it, i&#180;m inserting an include file on page that calls the thickbox, like below:

    <script type="text/javascript" src="jquery-latest.js"></script>
    <script type="text/javascript" src="thickbox.js"></script>
    <script type="text/javascript" src="thickbox.css"> </script>
    <link rel="stylesheet" href="thickbox.css" type="text/css" media="screen" />

    <script language="JavaScript">
    function showBox(){
    var a = document.getElementById('link');
    var t = a.title || a.name || null;
    var l = a.href || a.alt;
    var g = a.rel || false;
    tb_show(t,l,g);

    }


    </script>
    <link rel="stylesheet" href="thickbox.css" type="text/css" media="screen" />
    </head>

    <body onLoad="showBox();">
    <a href="group_multiple.asp?keepThis=true&TB_iframe=true&height=380&width=380" title="Multiple group" class="thickbox" id="link">Test</a>

    </body>

    The page is included and I can see the " Test " href, but nothing from thickbox to be shown..

    If I press the href link, the box opens perfectly..
    Not real sure how well it work by attempting your method.

    I'd suggest canning the onload in the <body> and try this:

    Code JavaScript:
    $(document).ready(function(){
    var a = $("#link");
    var t = a.title || a.name || null;
    var l = a.href || a.alt;
    var g = a.rel || false;
    tb_show(t,l,g);
    });

    Since you are using the jQuery library, they have some built in functions to manipulate your DOM.

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for the try, but it looks just the same, and only the opacity is applied..
    I'm guessing that the jquery can't find the element in time to apply the script on load process...
    If you have any extra time...any tip will be apreciated.

  4. #4
    SitePoint Zealot GiorgosK's Avatar
    Join Date
    Jun 2007
    Posts
    179
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    bradical's suggestion should work ... you are using jquery libraries and methods, I advise you to stick to the way jquery does things

  5. #5
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry

    I also believe it should work, but infact nothing changed..
    Do you guys believe the fact that i'm using the include file method to add the page that holds the jquery and thickbox could possibly change some expected behavior from my onload attempt?

  6. #6
    SitePoint Zealot GiorgosK's Avatar
    Join Date
    Jun 2007
    Posts
    179
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Send us a live test page so we can have a look ... maybe that would help

  7. #7
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It worked keeping the onload call and also the document.ready you suggested on thickbox.js...

  8. #8
    SitePoint Member
    Join Date
    Dec 2007
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mjunior View Post
    It worked keeping the onload call and also the document.ready you suggested on thickbox.js...
    mjunior how you solved that?


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
  •