Q:

setTimeout is executing function before time

Hi,
I have this code:
setTimeout(OverlayScrollbars(document.getElementById("content"), {}), 14000);

but the function is being executed right away rather than waiting 14 seconds before initializing. Why is that?
Thank you.

A:

You need to pass a callback function.
setTimeout(function() {
    OverlayScrollbars(document.getElementById("content"), {});
}, 14000);

They way you wrote it you were passing the return value of the OverlayScrollbars call as the callback function, which is probably not what you intended.

