So I wan't to preview some UI effects without the user having to refresh their client. I thought of doing this by creating a new instance of my Anim
object which is defined using a plain simple constructor.
function Anim(elem) {
this.elem = elem
}
Amin.prototype.zoomIn = function() {
// Do stuff
},
Amin.prototype.zoomOut = function() {
// Do stuff
}
// obj is a jQuery object, like $('div');
var instance = new Anim(obj);
So far so good, but how do I create a new instance of an object away from it's constructor?
This is in a different file, trying to create a new instance just for the sake of previewing it to the user. I'm receiving an error telling me that:
Anim is not defined
I get that it's out of scope, but how do I make it available?
$('span').on('click', function() {
new Anim( $('div') );
});