我对jQuery非常陌生。我需要在一定的时间间隔内显示数据库中的客户推荐信。就像在这个站点上显示的那样。在这个站点上有一个推荐信容器,在这个容器中,在一个时间段内,从数据库中逐个显示推荐信。我在谷歌上尝试了很长一段时间,但没有运气。如果你知道任何链接,我可以下载这样的脚本,这将对我很有帮助。谢谢。
发布于 2012-05-12 16:40:48
好吧,你可以看看你链接的网站是怎么做的,对吗,这里
(function ($) {
$(document).ready(function () {
var el = $("#testimonial");
if (el) {
RotateTestimonial();
setInterval(RotateTestimonial, 20000);
}
});
function RotateTestimonial() {
var pageUrl = "RandomTestimonial.php"
$.ajax({
type: "GET",
url: pageUrl,
cache: false,
success: function (msg) {
$("#testimonial").slideUp('slow').fadeOut(3000, function () {
var el = $("#testimonial"); //Refers to some container tag like <div> or <span> where the random message is to be written.
el.html(msg);
el.slideDown('slow').fadeIn('slow');
});
}
});
}
})(jQuery)发布于 2012-05-12 17:18:01
这段代码设置了一个20秒的计时器,将从YourPageHereReturnsHTML.aspx返回的HTML加载到证书div中。
<div id="testimonial">
</div>
<script>
(function($){
$(document).ready(function(){
var el = $("#testimonial");
if (el){
RotateTestimonial();
setInterval(RotateTestimonial, 20000);
}
});
function RotateTestimonial(){
var pageUrl = "YourPageHereReturnsHTML.aspx"
$.ajax({
type: "GET",
url: pageUrl,
cache:false,
success: function(msg) {
$("#testimonial").slideUp('slow').fadeOut(3000, function (){
var el = $("#testimonial");
el.html(msg);
el.slideDown('slow').fadeIn('slow');
});
}
});
}
})(jQuery)
</script>https://stackoverflow.com/questions/10565533
复制相似问题