Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magnify script not loading on page load, but page refresh #69

Open
goldlilys opened this issue Sep 21, 2021 · 0 comments
Open

Magnify script not loading on page load, but page refresh #69

goldlilys opened this issue Sep 21, 2021 · 0 comments

Comments

@goldlilys
Copy link

goldlilys commented Sep 21, 2021

Is it possible to check why your script would not work on page load, but only on page refresh?

I was able to make the simple demo work fine on page load, but when I added it to a wordpress website, the script only seems to work on page refresh, but not page load. I've been modifying the call to

(function($) {
$zoom = $(".zoom").magnify({
magnifiedWidth: 6000,
magnifiedHeight: 741,
afterLoad: function () {
console.log("Magnification powers activated 5!");
},
src: '[imageSrc]'
});

    $('html').on({

        magnifystart: function () {
            console.log('\'magnifystart\' event fired 5');
        },
        magnifyend: function () {
            console.log('\'magnifyend\' event fired 5');
        }
    });

})( jQuery );

so it loads even when not all is loaded yet, but even that doesn't work. It does display the "Magnification powers activated 5!" on the console, but the magnify class does not get added to the html element and the magnifystart and magnifyend calls do not log on console. It only shows up when I refresh the page.

But creating an auto refresh doesn't fix the issue either. Is it possible to use body instead of html? Not sure if that makes a difference, but what do you think could be the cause of it not firing during page load?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant