简体   繁体   English

在页面加载延迟后使用JavaScript淡入php内的div中?

[英]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? 嗨,有人知道您是否可以像下面这样控制php中的div?

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? 我想尝试找到一种方法,在页面加载3秒后使用javascript淡入div吗?

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. PHP在服务器上运行,不会影响jQuery稍后在浏览器中执行的操作。 What does the rendered HTML look like? 呈现的HTML是什么样的? Something like your example code should do just fine. 像您的示例代码之类的东西应该可以正常工作。 What's the problem, exactly? 到底是什么问题? Here's a simple demo: 这是一个简单的演示:

http://jsfiddle.net/tXhwH/1 http://jsfiddle.net/tXhwH/1

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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