I extended jquery object directly with a tween method.
Does this apply to all pages that use jquery or just within the page I made the extend. For example say this was a sublevel page and I had a script attached like below.
sublevel_page.js
$(function(){
/// some script to do with my sub level page
// my easing script
jQuery.extend( jQuery.easing,{
easeInOutExpo: function (x, t, b, c, d) {
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
}
})
})
Then I have lets say my home page which also has a script attached to it called home.js
$(function(){
// my home page code
// would I need to add my extend easing code again here or is it part of the
// framework once the extend happens in my sublevel_page
});
There are a few gray areas in jquery that I still don’t fully get and this is one. In a lot of languages you extend the framework in the application start level and it applies instantly to all code that uses the framework.
If my above assumption is correct then how would other pages that use jquery know as they are getting jquery scripts added to them when they load. Can someone please shed some light on this subject for me.
When you extend jquery and add your own plugins into it, it gets added to the global object jQuery or $. But you have to make sure that you include the files which have this extending code before other files in which you are trying to use them. I hope this makes sense.