简体   繁体   中英

fade in div inside php using javascript after delay on page load?

Hi does anyone know if you can control a div thats encased in php like the one below?

I want to try and find a way of using javascript to fade the div in after a 3 second delay when the page loads?

Can anyone show me a way of doing this?

i would imagine its something like this:

<script>

jQuery(document).ready(function($){ 
$('.dashboard_intro').hide().delay(2000).fadeIn(2000); 
$('.dashboard_intro_arrow').hide().delay(2000).fadeIn(2000); 
$('.dashboard_intro_text').hide().delay(2000).fadeIn(2000);  
$('.exit_intro').hide().delay(2000).fadeIn(2000);  

});

</SCRIPT>


<?php

$dashboard_intro = dashboard_intro();
while ($intro = mysql_fetch_array($dashboard_intro)) 
if ($intro['dashboard_intro'] == '0')  {
    echo "<div class=\"dashboard_intro_arrow\"></div><div class=\"dashboard_intro\"></div><div class=\"dashboard_intro_text\"><strong>Welcome to Your Dashboard</strong><br/><br/>These are your tools: Check Messages, Reviews & more.</div><div class=\"exit_intro\"></div>";
} ?>

PHP is run on the server and doesn't affect what jQuery does later in the browser. What does the rendered HTML look like? Something like your example code should do just fine. What's the problem, exactly? Here's a simple demo:

http://jsfiddle.net/tXhwH/1

<script>
$(function() {
  $('.dashboard_intro_text').delay(3000).fadeIn(2000); 
});
</script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM