PDA

View Full Version : onSlide function help for carousel



vinny8978
5 Jan 2011, 9:36 PM
Hey,
Is there any way to find out if the user is sliding the carousel and the direction it is going, as i have a main title and i want to slide it left or right depending on the current tab
Like the "Windows phone 7" design

vinny8978
6 Jan 2011, 6:24 PM
this is what i have so far, but it only moves when the next and previous cards are show...



next: function() {
var next = this.layout.getNext();
if (next) {
this.customDrag = true;
this.scrollToCard(next);

var winWid = $(window).width();
var elWid = $(".mainTitle").width();
var moveWid = ( (elWid - winWid) / this.items.length + 33 );
if(winWid >= elWid) {
}else{
$(".mainTitle").stop().animate({"left":"-=" + moveWid}, {duration: 300});
}

}
return this;
},

/**
* Switches the previous card
*/
prev: function() {
var prev = this.layout.getPrev();
if (prev) {
this.customDrag = true;
this.scrollToCard(prev);

var winWid = $(window).width();
var elWid = $(".mainTitle").width();
var moveWid = ( (elWid - winWid) / this.items.length + 33 );
if(winWid >= elWid) {
}else{
$(".mainTitle").stop().animate({"left":"+=" + moveWid}, {duration: 300});
}

}
return this;
},


but i want it to move with the cards...

how would i do this

vinny8978
8 Jan 2011, 4:38 PM
=; thanks for the help