Support » Plugins » iFrame On Load ThickBox – Giving Up Hope

  • Hello,

    So please help me:

    I can get this to work:

    <a class="thickbox" title="Signup" href="http://www.Example.com/signup.php?KeepThis=true&TB_iframe=true&height=550&width=900">Click here to signup now!</a>

    But I can’t get the URL to work onload:

    <html>
    <head>
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript" src="thickbox.js"></script>
    
    <script>
    function showThickbox() {
      $(document).ready(function() {
        tb_show("Login", "http://www.example.com/login.php?height=550&width=900", "");
      });
    }
    </script>
    
    <link rel="stylesheet" href="thickbox.css" type="text/css" media="screen" />
    </head>
    
    <body onload="showThickbox()">
    
    </body>
    </html>

    I’ve nearly given up hope.

    [No bumping, please.]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi Oz,

    Are you linking the css correctly? Try linking it absolutly ie /thickbox.css That might help.

    Lary

    Hello GeeseOz,

    In order for jQuery to load properly in WordPress you will need to alter the code a bit.

    <script>
    function showThickbox() {
      $(document).ready(function() {
        tb_show("Login", "http://www.example.com/login.php?height=550&width=900", "");
      });
    }
    </script>

    Should be

    <script>
    function showThickbox() {
      jQuery(document).ready(function($) {
        tb_show("Login", "http://www.example.com/login.php?height=550&width=900", "");
      });
    }
    </script>

    You can read more about it here in the codex.
    http://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_wrappers

    Thanks guys, I tried with no success.

    I get the popup on load no problem, it’s the content from the URL that doesn’t pull through. I don’t understand how both scripts can be so different.

    Append TB_iframe=true to the end of your URL (it will get parsed out, and no, it is NOT apart of your URL query string. Needless to say, it should be the last item on your URL parameter).

    More info is here:
    Open/Call thickbox without using the “class” attribute.

    Thanks Steve but I ended up using a different script as I couldn’t get it working in time.

    Just for future reference then, I had the same problem, but when I added a 0.2 second timeout it worked fine. That would look like this:

    jQuery(document).ready(function() {
    					setTimeout(function(){ tb_show("Login", "http://www.example.com/login.php?height=550&width=900", ""); },200);
    			});
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘iFrame On Load ThickBox – Giving Up Hope’ is closed to new replies.