Height of div no load

Asked

Viewed 73 times

6

How to leave the field at 2 divs about the same height as #result4 that I gave a load?

<script>
$(document).ready(function() {   
    $( ".buscascript<?php echo "$row[id]"; ?>" ).click(function() {
        $( "#fechargame" ).show();
        $( "#result4" ).show();
        $( "#result5" ).show();
        $( "#result4" ).load( "busca.php?game=<?php echo "$row[id]"; ?>" );
        var altura = $("#result4").height();
        $( "#publicidade1a" ).height(altura);
        $( "#publicidade" ).height(altura);
    });    
});
</script>

1 answer

5


Try it like this:

    <script>
    $(document).ready(function() {
        $( ".buscascript<?php echo "$row[id]"; ?>" ).click(function() {
            $( "#fechargame" ).show();
            $( "#result4" ).show();
            $( "#result5" ).show();
            $( "#result4" ).load( "busca.php?game=<?php echo "$row[id]"; ?>", function(){
                var altura = $("#result4").height();
                $( "#publicidade1a" ).height(altura);
                $( "#publicidade" ).height(altura);
            });
        });
    });
</script>

To function() who is in the load is the function indicating the end of the load run by load. By now, you have the right time to tag publicidade1a and publicidade.

  • 1

    now it worked, vlw!!!

  • good ... !!!

  • 1

    Fulvio, the cool thing is to explain the why of the solution (in this case, the function() of load)... The guide [Answer] is worth a reading ;)

  • 1

    @brasofilo is already explained ...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.