Less dependent on window object: first step for CommonJS/AMD compatibility

It would be great if magnific-popup would support CommonJS/AMD to work with Browserify/RequireJS.

This is a first step to it, because with this PR it no longer requires environments where jQuery is attached to the window object.