mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 01:51:40 -05:00
don't animate the first render
This commit is contained in:
parent
bb9bd50eab
commit
e9c3d1c297
1 changed files with 8 additions and 6 deletions
|
@ -57,8 +57,8 @@ Template.post_item.created = function(){
|
|||
Template.post_item.rendered = function(){
|
||||
var self = this;
|
||||
var rank = self.data._rank;
|
||||
|
||||
// t("post_item");
|
||||
var $this = $(this.find(".post"));
|
||||
|
||||
if(self.data){
|
||||
var distanceFromTop= 0;
|
||||
for(var i=1; i<=rank; i++){
|
||||
|
@ -67,8 +67,6 @@ Template.post_item.rendered = function(){
|
|||
var new_distance = distanceFromTop ;
|
||||
var old_distance = self.current_distance ;
|
||||
|
||||
var $this = $(this.find(".post"));
|
||||
|
||||
// at rendering time, move posts to their old place
|
||||
$this.css("top", old_distance+"px");
|
||||
|
||||
|
@ -77,9 +75,13 @@ Template.post_item.rendered = function(){
|
|||
$this.css("top", new_distance+"px");
|
||||
|
||||
// we don't want elements to be animated the first ever time they load, so we only set the class "animate" after that
|
||||
$this.addClass("animate");
|
||||
self.current_distance=new_distance;
|
||||
}, 100);
|
||||
}, 1);
|
||||
|
||||
Meteor.setTimeout(function(){
|
||||
$this.addClass("animate");
|
||||
}, 2);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue