Skip to content

Commit c30df7c

Browse files
author
Yaron Nachshon
committed
css animtation instead of jquery animation
1 parent 58a40e4 commit c30df7c

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

intro.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,17 @@
4141
newOffset.top = targetBoundingClientRect.bottom - element.outerHeight();
4242
}
4343

44-
element.animate(newOffset, {
45-
duration: duration,
46-
complete: function(){
44+
if(duration === 0){
45+
defer.resolve();
46+
}else{
47+
$(element).one('transitionend', function(){
4748
defer.resolve();
48-
}
49-
});
49+
});
50+
}
51+
52+
var durationInSecs = duration / 1000;
53+
element.css('transition', 'left ' + durationInSecs + 's ease-in-out, top ' + durationInSecs + 's ease-in-out');
54+
element.offset(newOffset);
5055

5156
return defer.promise();
5257
}
@@ -210,7 +215,7 @@
210215

211216
this.render = function(){
212217
var defer = jQuery.Deferred();
213-
var duration = wasRendered ? 500 : 0;
218+
var duration = wasRendered ? 800 : 0;
214219

215220
that.element.show();
216221
innerPositionElement(that.element, targetElement, hintPosition, duration).then(function(){

0 commit comments

Comments
 (0)