Difference between revisions of "Team:Tuebingen/Art and Design"

Line 40: Line 40:
 
var left = document.createElement('div');
 
var left = document.createElement('div');
 
left.style.cssText = 'position:absolute;top:0px;bottom:0px;left:0px;right:50%;z-index:100;cursor:pointer;';
 
left.style.cssText = 'position:absolute;top:0px;bottom:0px;left:0px;right:50%;z-index:100;cursor:pointer;';
left.oncklick = function() {};
+
left.onmouseover = function() {this.interval = window.setInterval('rotateCarousel(-10)',200);};
 +
left.onmouseout = function() {window.clearInterval(this.interval);};
 
carousel.appendChild(left);
 
carousel.appendChild(left);
 
var right = document.createElement('div');
 
var right = document.createElement('div');
 
right.style.cssText = 'position:absolute;top:0px;bottom:0px;right:0px;left:50%;z-index:100;cursor:pointer;';
 
right.style.cssText = 'position:absolute;top:0px;bottom:0px;right:0px;left:50%;z-index:100;cursor:pointer;';
right.oncklick = function() {};
+
right.onmouseover = function() {this.interval = window.setInterval('rotateCarousel(10)',200);};
 
carousel.appendChild(right);
 
carousel.appendChild(right);
 
}
 
}
var carouselPos = [0,1,2]
+
var slotPos = [315,0,45,90,135,180,225,270]
 
slots[0].style.display = 'block';
 
slots[0].style.display = 'block';
 
slots[0].style.marginLeft = '-325px';
 
slots[0].style.marginLeft = '-325px';
Line 60: Line 61:
  
 
function rotateCarousel(step) {
 
function rotateCarousel(step) {
 +
for (var i=0;i<slots.length;i++) {
 +
slotPos[i]+=step;
 +
if (slotPos[i]>=360) slotPos[i]-=360;
 +
if (slotPos[i]<0) slotPos[i] = 360-slotPos[i];
 +
}
 +
renderCarousel();
 +
}
 +
 +
function renderCarousel() {
  
 
}
 
}

Revision as of 15:33, 18 September 2015

<
>