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

Unable to trigger "finished" bind event after destroyed #170

Open
andrewlim7 opened this issue Aug 8, 2021 · 0 comments
Open

Unable to trigger "finished" bind event after destroyed #170

andrewlim7 opened this issue Aug 8, 2021 · 0 comments

Comments

@andrewlim7
Copy link

andrewlim7 commented Aug 8, 2021

I am having issue to re-trigger after I have destroyed it in bind event. My intention is to re-trigger the marquee after screen changed / resize. I am using $(window).resize() with a boolean , so whenever the boolean is true then after the marquee finish the loop and destroy it and initialise it. However it manages to initialise it but the bind event no longer get triggered. May I know how can I trigger the "finished" bine event again ?

UPDATE:
Using the older version from cdn is working -> https://cdn.jsdelivr.net/jquery.marquee/1.3.1/jquery.marquee.min.js
However the latest version is not working as expected. Is this a bug or some error in the code?

Here is the sample of the code,

var screenChanged = false;
    var tickerSettings = 
        {
            duration: 1000,
            gap: 50,
            delayBeforeStart: 0,
            direction: 'left',
            duplicated: false
        };
    $('.marquee').marquee(tickerSettings);

    $('.marquee').bind('finished', function () {
        console.log("finished");
        if(screenChanged != false){
            console.log("destroy");
            $(this).marquee('destroy');
            $(this).marquee(tickerSettings);
            screenChanged = false;
            console.log("screenChanged set back to " + screenChanged);
        }
    })

    $(window).resize(function() {
        if(screenChanged != true){
            screenChanged = true;
            console.log(screenChanged);
        }
    });
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