Team:Heidelberg/js/frontpage
From 2014.igem.org
(Difference between revisions)
Line 3: | Line 3: | ||
var ring = $("#ring"); | var ring = $("#ring"); | ||
var width = placeholder.outerWidth(false); | var width = placeholder.outerWidth(false); | ||
+ | var position = placeholder.offset(); | ||
if(!setPosition){ | if(!setPosition){ | ||
- | |||
ring = ring.css(position); | ring = ring.css(position); | ||
} | } | ||
+ | ring.data("start", "transform:rotate(0deg);left:"+position.left+"px"); | ||
ring.css("width", width+"px"); | ring.css("width", width+"px"); | ||
placeholder.css("height", ring.height()+"px"); | placeholder.css("height", ring.height()+"px"); | ||
Line 13: | Line 14: | ||
$(document).ready(function(){ | $(document).ready(function(){ | ||
recalcRingSize(true); | recalcRingSize(true); | ||
- | |||
- | |||
skrollr.init(); | skrollr.init(); | ||
}); | }); |
Revision as of 10:13, 22 September 2014
recalcRingSize = function(setPosition) { var placeholder = $("#img-placeholder"); var ring = $("#ring"); var width = placeholder.outerWidth(false); var position = placeholder.offset(); if(!setPosition){
ring = ring.css(position);
} ring.data("start", "transform:rotate(0deg);left:"+position.left+"px"); ring.css("width", width+"px"); placeholder.css("height", ring.height()+"px"); };
$(document).ready(function(){ recalcRingSize(true); skrollr.init(); });
$( window ).resize(function() { recalcRingSize(false); });