Reputation: 13557
I have this code:
function someFunction () {
alert('fired!')
}
var options = [
{selector: 'footer', offset: 50, callback: 'someFunction()' },
];
Materialize.scrollFire(options);
I'm getting an error Uncaught ReferenceError: someFunction is not defined
I do understand why it happens, but i can't get, how should i trigger someFunction anyway?
ps. if i change 'someFunction()'
to alert('fired!')
, alert happens.
Upvotes: 1
Views: 20
Reputation: 32511
Just change it to a reference to the function:
var options = [
{
...
callback: someFunction
];
Upvotes: 2