gongpex Posted March 12, 2018 Share Posted March 12, 2018 Hello everyone, I found a piece of cake jquery code such this : $.Animation( this, { x: x, y: y }, { duration: speed }).progress( function( e ) { this.css( "background-position", e.tweens[0].now + "px " + e.tweens[1].now + "px" ); }); When I looked for $.Animation and progress reference on google I didn't find it. Q : Could y'all help me to find this reference? Many Thanks Link to comment Share on other sites More sharing options...
Ingolme Posted March 12, 2018 Share Posted March 12, 2018 If you have the rest of the source code from that page you should be able to see which libraries are being included. It is either a jQuery plugin or not jQuery at all. Link to comment Share on other sites More sharing options...
gongpex Posted March 13, 2018 Author Share Posted March 13, 2018 14 hours ago, Ingolme said: If you have the rest of the source code from that page you should be able to see which libraries are being included. It is either a jQuery plugin or not jQuery at all. Alright I will give you the full of code, tell me where is the method of JQuery according code on below : (function( $ ) { $.fn.animateBgPosition = function( x, y, speed ) { var pos = this.css( "background-position" ).split( " " ); this.x = parseInt( pos[0], 10 ) || 0; this.y = parseInt( pos[1], 10 ) || 0; $.Animation( this, { x: x, y: y }, { duration: speed }).progress( function( e ) { this.css( "background-position", e.tweens[0].now + "px " + e.tweens[1].now + "px" ); }); return this; }; })( jQuery ); please explain to me about : tweens and now Thanks Link to comment Share on other sites More sharing options...
dsonesuk Posted March 13, 2018 Share Posted March 13, 2018 It is jQuery, and is a simple plugin, tweens and now are described here https://stackoverflow.com/questions/16541206/jquery-what-is-a-tween-object the plugin and how it is used, here https://codepen.io/gabrieleromanato/pen/emzPXz Link to comment Share on other sites More sharing options...
gongpex Posted March 14, 2018 Author Share Posted March 14, 2018 Hello thanks for reply, How about $.Animation ? I didn't find it on google, could u give me documentation link please? Thanks Link to comment Share on other sites More sharing options...
dsonesuk Posted March 14, 2018 Share Posted March 14, 2018 I imagine it is part of jQuery framework, as the link said there is not much documentation on these terms specifically, as these are part of jQuerys animation() function where the user would add the required information, then the tweens(), $Animation would be used in framework background itself.. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now