Skip to content

Commit

Permalink
Merge pull request olton#1 from greensolid/transit
Browse files Browse the repository at this point in the history
JS enhancements
  • Loading branch information
Matthias Fax committed Feb 1, 2014
2 parents 86898a8 + 17054d9 commit 0876e21
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 36 deletions.
10 changes: 5 additions & 5 deletions docs/js/metro/metro-carousel.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function( $ ) {
$.widget("metro.carousel", {

version: "1.0.0",
version: "1.0.1",

options: {
auto: true,
Expand Down Expand Up @@ -250,11 +250,11 @@

_effectSlide: function(currentSlide, nextSlide, duration){
$(currentSlide)
.animate({left: this._outPosition}, duration);
.transit({left: this._outPosition}, duration);
$(nextSlide)
.css('left', this._outPosition * -1)
.show()
.animate({left: 0}, duration);
.transit({left: 0}, duration);
},

_effectSlowdown: function(currentSlide, nextSlide, duration){
Expand All @@ -267,14 +267,14 @@
};

$(currentSlide)
.animate({left: this._outPosition}, options);
.transit({left: this._outPosition}, options);


//$(nextSlide).find('.subslide').hide();
$(nextSlide)
.css('left', this._outPosition * -1)
.show()
.animate({left: 0}, options);
.transit({left: 0}, options);

//setTimeout(function(){
// $(nextSlide).find('.subslide').fadeIn();
Expand Down
6 changes: 3 additions & 3 deletions docs/js/metro/metro-countdown.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function( $ ) {
$.widget("metro.countdown", {

version: "1.0.0",
version: "1.0.1",

options: {
style: {
Expand Down Expand Up @@ -184,13 +184,13 @@
digit
.before(replacement)
.removeClass('static')
.animate({top:'2.5em'},'fast',function(){
.transit({top:'2.5em'},'fast',function(){
digit.remove();
});

replacement
.delay(100)
.animate({top:0,opacity:1},'fast');
.transit({top:0,opacity:1},'fast');

return true;
}
Expand Down
18 changes: 9 additions & 9 deletions docs/js/metro/metro-live-tile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function( $ ) {
$.widget("metro.livetile", {

version: "1.0.0",
version: "1.0.1",

options: {
effect: 'slideLeft',
Expand Down Expand Up @@ -99,11 +99,11 @@
};

$(currentFrame)
.animate({top: -_out}, options);
.transit({top: -_out}, options);
$(nextFrame)
.css({top: _out})
.show()
.animate({top: 0}, options);
.transit({top: 0}, options);
},

_effectSlideDown: function(currentFrame, nextFrame){
Expand All @@ -114,11 +114,11 @@
};

$(currentFrame)
.animate({top: _out}, options);
.transit({top: _out}, options);
$(nextFrame)
.css({top: -_out})
.show()
.animate({top: 0}, options);
.transit({top: 0}, options);
},

_effectSlideLeft: function(currentFrame, nextFrame){
Expand All @@ -129,11 +129,11 @@
};

$(currentFrame)
.animate({left: _out * -1}, options);
.transit({left: _out * -1}, options);
$(nextFrame)
.css({left: _out})
.show()
.animate({left: 0}, options);
.transit({left: 0}, options);
},

_effectSlideRight: function(currentFrame, nextFrame){
Expand All @@ -144,11 +144,11 @@
};

$(currentFrame)
.animate({left: _out}, options);
.transit({left: _out}, options);
$(nextFrame)
.css({left: -_out})
.show()
.animate({left: 0}, options);
.transit({left: 0}, options);
},

_destroy: function(){},
Expand Down
2 changes: 1 addition & 1 deletion docs/js/metro/metro-progressbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
}
bar.appendTo(element);
if (this.options.animate) {
bar.css('width', this.value() + '%').animate({ width: newVal + '%' });
bar.css('width', this.value() + '%').transit({ width: newVal + '%' });
} else {
bar.css('width', newVal + '%');
}
Expand Down
23 changes: 13 additions & 10 deletions docs/js/metro/metro-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@
_startMoveMarker: function(e){
var element = this.element, o = this.options, that = this, hint = element.children('.hint');

$(element).on('mousemove', function (event) {
$(document).mousemove(function (event) {
that._movingMarker(event);
if (!element.hasClass('permanent-hint')) {
hint.css('display', 'block');
}
});
$(element).on('mouseup', function () {
$(element).off('mousemove');
element.off('mouseup');
$(document).mouseup(function () {
$(document).off('mousemove');
$(document).off('mouseup');
element.data('value', that.options.position);
element.trigger('changed', that.options.position);
o.changed(that.options.position, element);
Expand Down Expand Up @@ -154,16 +154,19 @@
var size, size2, o = this.options, colorParts = 0, colorIndex = 0, colorDelta = 0,
marker = this.element.children('.marker'),
complete = this.element.children('.complete'),
hint = this.element.children('.hint');
hint = this.element.children('.hint'),
oldPos = this._percToPix(this.options.position);

colorParts = o.colors.length;
colorDelta = o._slider.length / colorParts;

if (this.options._slider.vertical) {
var oldSize = this._percToPix(this.options.position) + this.options._slider.marker,
oldSize2 = this.options._slider.length - oldSize;
size = this._percToPix(value) + this.options._slider.marker;
size2 = this.options._slider.length - size;
marker.css('top', size2);
complete.css('height', size);
marker.stop(true).css('top', oldSize2).transit({top: size2});
complete.stop(true).css('height', oldSize).transit({height: size});
if (colorParts) {
colorIndex = Math.round(size / colorDelta)-1;
complete.css('background-color', o.colors[colorIndex<0?0:colorIndex]);
Expand All @@ -173,14 +176,14 @@
}
} else {
size = this._percToPix(value);
marker.css('left', size);
complete.css('width', size);
marker.stop(true).css('left', oldPos).transit({left: size});
complete.stop(true).css('width', oldPos).transit({width: size});
if (colorParts) {
colorIndex = Math.round(size / colorDelta)-1;
complete.css('background-color', o.colors[colorIndex<0?0:colorIndex]);
}
if (o.showHint) {
hint.html(Math.round(value)).css('left', size - hint.width()/2);
hint.html(Math.round(value)).stop(true).css('left', oldPos - hint.width()/2).transit({left: size - hint.width()/2});
}
}

Expand Down
4 changes: 2 additions & 2 deletions docs/js/metro/metro-stepper.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function( $ ) {
$.widget("metro.stepper", {

version: "1.0.0",
version: "1.0.1",

options: {
steps: 3,
Expand Down Expand Up @@ -41,7 +41,7 @@

$.each(steps, function(i, step){
var left = i == 0 ? 0 : (element_width - step_width)/steps_length * i;
$(step).animate({
$(step).transit({
left: left
});
});
Expand Down
6 changes: 3 additions & 3 deletions docs/js/metro/metro-streamer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function( $ ) {
$.widget("metro.streamer", {

version: "1.0.0",
version: "1.0.1",

options: {
scrollBar: false,
Expand Down Expand Up @@ -175,7 +175,7 @@
streams_width = element.find(".streams").outerWidth() + 2;

setTimeout(function(){
element.find(".events").animate({
element.find(".events").transit({
scrollLeft: "+="+ (interval.offsetLeft - streams_width)
}, speed, function(){
that._afterSlide();
Expand All @@ -189,7 +189,7 @@
var that = this, element = this.element, groups = element.find(".event-group"), streams_width = element.find(".streams").outerWidth() + 2;

setTimeout(function(){
element.find(".events").animate({
element.find(".events").transit({
scrollLeft: "+="+ (groups[group-1].offsetLeft - streams_width)
}, speed, function(){
that._afterSlide();
Expand Down
6 changes: 3 additions & 3 deletions docs/js/metro/metro-times.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function( $ ) {
$.widget("metro.times", {

version: "1.0.0",
version: "1.0.1",

options: {
style: {
Expand Down Expand Up @@ -174,13 +174,13 @@
digit
.before(replacement)
.removeClass('static')
.animate({top:'2.5em',opacity:0},'fast',function(){
.transit({top:'2.5em',opacity:0},'fast',function(){
digit.remove();
});

replacement
.delay(100)
.animate({top:0,opacity:1},'fast');
.transit({top:0,opacity:1},'fast');

return true;
}
Expand Down

0 comments on commit 0876e21

Please sign in to comment.