problem load() event !
problem load() event !
Hello,
My code :
- index.php
- <script type="text/javascript">
- $(document).ready(function() {
- $("#centre_contenu").hide();
- $("#loader").show();
- $("#centre_contenu").load("gestion_page.php", function(data) {
- $("#loader").fadeOut('fast', function() {
- $("#centre_contenu").fadeIn(1000);
- });
- });
- });
- </script>
- <div id="centre">
- <span id="loader"><img src="images/loader.gif" border="0" alt="Loading" title="Loading" /> Loading in progress</span>
- <div id="centre_contenu"></div>
- </div>
- gestion_page.php :
- <div id="actus_droite">
- <div class="form_ajout_actu"></div>
- </div>
- <script type="text/javascript">
- $(document).ready(function(){
- alert($('.form_ajout_actu').offset().top);
- });
- </script>
My problem :
offset () evaluates the actual position of the element too early.
The alert returns 0 when it should return a value of about 250!
- <script type="text/javascript">
- $(document).ready(function() {
- $("#centre_contenu").hide();
- $("#loader").show();
- $("#centre_contenu").load("gestion_page.php", function(data) {
- $("#loader").fadeOut('fast', function() {
- $("#centre_contenu").fadeIn(1000);
- alert($('.form_ajout_actu').offset().top);
- });
- });
- });
- </script>
The alert returns the correct value.
How to work around this problem?
Ideas?
Thank you in advance for your help.