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

Working intermittently on mobile #171

Open
anartfulscience opened this issue Oct 5, 2016 · 1 comment
Open

Working intermittently on mobile #171

anartfulscience opened this issue Oct 5, 2016 · 1 comment

Comments

@anartfulscience
Copy link

Hello,

Great plugin. The only issue I'm having is on the iPhone. Desktop is fine.

I'm loading an accordion and then it's function.

After first load everything works as expected. If you revisit the page the accordion becomes unresponsive. I've added the unique: 1 flag but it has little effect.

After a few refreshes it eventually works again.

Can you let me know if I'm implementing basket incorrectly?

Thanks, Stephen
basket.txt

@Loksly
Copy link

Loksly commented Oct 14, 2016

You may not use jQuery until you are sure it has been loaded.
Try something like.

function everythingWasSuccessfullyLoaded(){
    var opts =  { exclusive: false };
    jQuery("#accordion").accordion();
    jQuery("#accordion__section--1, #accordion__section--2, #accordion__section--3, #accordion__section--4, #accordion__section--5").accordion(opts);
}

function somethingWentWrong(err){
    console.error(err);
    //try to recover
}

basket
    .require( { url: 'jquery.js' } )
    .then(function(){
        basket
            .require(
                { url: 'js/charts-loader.js' },
                { url: 'js/accordion.js', unique: 1 },
                { url: 'js/jquery.widowFix.min.js', unique: 1 },
                { url: 'js/pandalocker.2.0.7.min.js', unique: 1 })
            .then(
                function(){
                    basket.require(
                        { url: "js/google-charts.js" },
                        { url: "js/function-accordian.js", unique: 1 },
                        { url: "js/function-widowfix.js", unique: 1 },
                        { url: "js/functions-social-locker.js", unique: 1 })
                    .then( everythingWasSuccessfullyLoaded, somethingWentWrong );
                },somethingWentWrong);
    }, somethingWentWrong);     

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

2 participants