hello im using this code to load content from another php file.
$(document).ready(function(){
setInterval(function(){
$('.live-stream ul').each(function(){
$(this).load('tx.php');
});
}, 1000);
});
this works correctly but i want script to fadeIn each "li" when a new record added, anyone?
the thing i want to do is something like facebook's live user action feed that on the right top of facebook home
The jQuery animate() method is used to create custom animations. Syntax: $(selector).animate({params},speed,callback); The required params parameter defines the CSS properties to be animated.
$body = $("body"); $(document). on({ ajaxStart: function() { $body. addClass("loading"); }, ajaxStop: function() { $body. removeClass("loading"); } });
The jQuery library provides several techniques for adding animation to a web page. These include simple, standard animations that are frequently used, and the ability to craft sophisticated custom effects.
jQuery can be several times slower than CSS when talking about animations. CSS animations and transitions have the advantage of being hardware accelerated by the GPU, which is really good in moving pixels.
You have to hide it first.
$(this).hide().load("tx.php").fadeIn('500');
Try something like this:
$(document).ready(function(){
setInterval(function(){
$('.live-stream ul').each(function(){
$(this).hide().load('tx.php').fadeIn('500');
});
}, 1000);
});
Note the use of fadeIn()
and hide()
... You don't need hide if you already have the <li>
's hidden.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With