Team:Heidelberg/js/frontpage

From 2014.igem.org

(Difference between revisions)
Line 8: Line 8:
   ring.css(position);
   ring.css(position);
}
}
-
ring.attr("data-start", "transform:rotate(0deg); left:"+position.left+"px; top:"+position.top+"px");
 
ring.css("width", width+"px");
ring.css("width", width+"px");
placeholder.css("height", ring.height()+"px");
placeholder.css("height", ring.height()+"px");
-
var endtop = $('.second').offset().top + 10;
 
-
ring.attr("data-300", "transform:rotate(180deg); left:-260px; top:"+endtop+"px");
 
-
ring.attr("data-500", "transform:rotate(360deg);");
 
};
};
Line 38: Line 34:
$( window ).resize(function() {
$( window ).resize(function() {
recalcRingSize(false);
recalcRingSize(false);
-
skrollr.get().refresh();
+
//skrollr.get().refresh();
});
});

Revision as of 09:27, 23 September 2014

recalcRingSize = function(setPosition) { var placeholder = $("#img-placeholder"); var ring = $("#ring"); var width = placeholder.outerWidth(false); var position = placeholder.offset(); position.left = position.left - $(".container").offset().left; if(!setPosition){

 ring.css(position);

} ring.css("width", width+"px"); placeholder.css("height", ring.height()+"px");

};

$(document).ready(function(){

  controller = new ScrollMagic();
  $("#ring").load(function(){
     recalcRingSize(true);
     $("#img-placeholder img").css("display", "none");
     $("#ring").css("visibility", "");
     //skrollr.get().refresh();
  });
  
  var ringTween = new TweenMax("#ring", 0.5, { rotation: 360, left: -200, top: 600});
  
  var scene = new ScrollScene({triggerElement: ".second", duration: 300})

.setTween(ringTween) .addTo(controller);

  scene.addIndicators();
  //skrollr.init();

});

$( window ).resize(function() { recalcRingSize(false); //skrollr.get().refresh(); });