WordPress.org

Ready to get started?Download WordPress

Forums

iFrame On Load ThickBox - Giving Up Hope (7 posts)

  1. GeeseOz
    Member
    Posted 3 years ago #

    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.]

  2. Larry109uk
    Member
    Posted 3 years ago #

    Hi Oz,

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

    Lary

  3. BenjaminRMueller
    Member
    Posted 3 years ago #

    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

  4. GeeseOz
    Member
    Posted 3 years ago #

    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.

  5. Steveorevo
    Member
    Posted 3 years ago #

    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:
    http://rodnavarroweb.wordpress.com/2009/06/07/opencall-thickbox-without-using-the-class-attribute/

  6. GeeseOz
    Member
    Posted 3 years ago #

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

  7. Christiann
    Member
    Posted 3 years ago #

    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);
    			});

Topic Closed

This topic has been closed to new replies.

About this Topic