[英]PHP - Text fading effect?
I've been researching all over for this, basically I have a table that displays "eco'texthere';' 我一直在为此进行研究,基本上我有一个显示“ eco'texthere';”的表格。 after posting the data. 发布数据后。
How would I make the text fade in eg : 我如何使文本淡入例如:
Table ---> User Send data using submit button ---> displays back message "rotating data" ---> Now text fades in saying "sucessfully sent". 表--->用户使用提交按钮发送数据--->显示回传消息“旋转数据” --->现在文字淡出,显示“成功发送”。 (Mostly using echo in PHP). (通常在PHP中使用echo)。
Will I need a timeout function and Jquery for this? 我需要一个超时函数和Jquery吗?
Yes - PHP is done executing by the time you're able to show the response to the user. 是的-在您可以向用户显示响应时,PHP已完成执行。 You would want to take that PHP response (via AJAX), put it in a DOM element (like a div), and then animate that DOM element with jQuery once the AJAX call is complete. 您可能想获取该PHP响应(通过AJAX),将其放入DOM元素(如div),然后在完成AJAX调用后使用jQuery对该DOM元素进行动画处理。
you can use Mootools instead of jQuery: 您可以使用Mootools代替jQuery:
http://mootools.net/docs/core/Fx/Fx.Tween http://mootools.net/docs/core/Fx/Fx.Tween
You'll want to import a jQuery library like the fellows above recommended... Then you have something like: 您将需要像上面推荐的伙伴一样导入一个jQuery库...然后您将得到:
$.get("yourphpscript.php",function(response){
$("#somediv").html(response).fadeIn('slow');
});
The div #somediv should start out with display:none;. div #somediv应该以display:none;开始。
I found this working for me if un wanna use javascript: 如果您不想使用javascript,我发现这对我有用:
<head>
<!-- Javascript -->
<script type="text/javascript">
function showHideLayer(id){
e = document.getElementById(id);
if(e.style.display=="block"){
e.style.display = "none";
} else {
e.style.display = "block";
}
}
</script>
</head>
<body>
<!-- Link zum Anzeigen/Verstecken -->
<a href="alternativeLink" onclick="showHideLayer('myLayer');return(false)">Hide/Show</a>
<div id="myLayer" style="display:none;">
My hidden layer
</div>
是的,因为这是一种客户端效果,所以我建议您研究一下jQuery来做到这一点,例如通过使用fadeIn
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.