[jQuery] Thickbox doesn't work in firefox from nested div???

Discussion in 'jQuery' started by 123GoToAndPlay, Jan 6, 2009.

  1. #1
    Hi all,

    I have a page called pageTest.php with the following code
    
    <a href="getDetails.php?id=<?php echo $rs['id']; ?>&keepThis=true&TB_iframe=true&height=350&width=530" title="Details <?php echo $rs['name']; ?>" class="thickbox">Get details</a>
    
    Code (markup):
    When i click "Get details" the thickbox works and i get the details.

    But when i first load the pageTest.php like so

    <script type="text/javascript">
    $(document).ready(function() {
    		
       $("#pageTest").click(function() {
       $("#content").css("overflow-y", "scroll");
         $("#content").load("pageTest.php");
       });
       
     });
    
    </script>
    Code (markup):
    When i click "Get details" the thickbox isn't shown???

    This all happens in firefox, in ie i don't have a problem.

    Anyone know of a fix
     
    123GoToAndPlay, Jan 6, 2009 IP
  2. zerxer

    zerxer Peon

    Messages:
    368
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Where exactly are you calling the function that binds the click handler to the 'thickbox' class items? You'd need to do that after your .load() function finishes, such as setting it as a callback function (3rd parameter for the .load() function).

    You have to put this function call in it: tb_init('a.thickbox'); Example:

    <script type="text/javascript">
    $(document).ready(function() {
    		
       $("#pageTest").click(function() {
       $("#content").css("overflow-y", "scroll");
         $("#content").load("pageTest.php", "", function(){tb_init('a.thickbox');});
       });
       
     });
    
    </script>
    Code (markup):
    Try that. I'm not sure how it can work properly in IE though how you have it now.. You'd have to show all the code you have on the page so I could see if there's any other problems. Try this fix first though.
     
    zerxer, Jan 7, 2009 IP