Gix075 / jqueryIntroLoader

a jQuery plugin for generate animated Intro Loading Pages
GNU General Public License v3.0
48 stars 24 forks source link

Stop at custom time #1

Closed andrewslaughter closed 9 years ago

andrewslaughter commented 9 years ago

Not really an issue but more a modification. Is there a way to overwrite the delayTime dynamically. For example I'm running some ajax in the background and when that has finished processing I want to remove loader, but not until.

Thanks

Gix075 commented 9 years ago

Hi andrewslaughter, thanks for you interest. I think that is impossible to do what you need with this version. I'm really sorry. At now this plugin stop itself only on window load event. I'm working to add some custom events like ajax success but i need few time more to develop it. Follow me, or star, or watch this repository to know when new versions will be available.

andrewslaughter commented 9 years ago

Hi thanks for that.

I think I have actually managed a work around, If you set the delatyTime to a massive amount, it will then stop open.

I have then on my ajax success called another function that sets the $('#element').fadeOut();

seems to work but I will have to do some more testing.

But a great plugin all the same

Gix075 commented 9 years ago

Ok, it seems a good solution. Let me know if it's really ok after your testing and, if you want, show me your site where you use plugin ... I will be happy. Tnx again!

andrewslaughter commented 9 years ago

Hi, had to modify it slightly but here is the js

    var tm;
    function timerUp() {
        tm = setInterval(function () {killLoader()}, 10000);
    }
    function killLoader() {
        console.log('trying to kill');
        $('#element').fadeOut();
        clearInterval(tm);
    }
    function showTimer() {
        if($('#element').is(':hidden')) {
            console.log('timer hidden');
            $('#element').fadeIn();
        }
        timerUp()
        console.log('trying to show animation');
        try {
        $("#element").introLoader({
                            animation: {
                                name: 'simpleLoader',
                                options: {
                                    effect:'slideUp',
                                    ease: "easeInOutCirc",
                                    style: 'dark',
                                    delayTime: 10000, //delay time in milliseconds
                                    animationTime: 500
                                }
                            },
                            spinJs: {
                                lines: 13, // The number of lines to draw
                                length: 20, // The length of each line
                                width: 10, // The line thickness
                                radius: 30, // The radius of the inner circle
                                corners: 1, // Corner roundness (0..1)
                                color: '#fff', // #rgb or #rrggbb or array of colors
                            }
            });
        } catch(e) { console.log('error while trying to load loader ' + e.message); }
    }

At the minute I have just called a timer to hide it but when I use it I will call the killLoader when my ajax has finished

Gix075 commented 9 years ago

Hi, I made an unofficial custom version with 2 new option that you can use for start and stop plugin. I don't know if is pretty correct, but it seems to work as you need. As i told before, i think to update this feature on future releases, but you can use this custom version ... if you want and if it works.

You can use in this way:

// start loader
var loader = $(element).introLoader({
        event: "custom",
        action: "start", 
        animation: [...],  // your animation option here
        spinJs: [...] // your spinJs option here
});

// stop loader 
loader.introLoader({ event:"custom", action:"stop"});

You can download this custom plugin here Warning: this version not includes helper plugins, so you had to load helpers in your page.

This version was removed. Use the current version with the start() and stop() methods

Gix075 commented 9 years ago

Ok, I made a plugin update, now it's at version 1.1.0 and it can be played and stopped as you need. You can read the documentation but use it it's simple. Using the new option stop:false (added to animation.options parameters) you can load the introLoader page without stop it, then when you need, you can stop it with a new data method .stop()

See this DemoPage to see this feature used in a little box on page.

andrewslaughter commented 9 years ago

brilliant thanks


From: Gix075 notifications@github.com To: Gix075/jqueryIntroLoader jqueryIntroLoader@noreply.github.com Cc: andrewslaughter a.slaughter@talk21.com Sent: Saturday, 13 December 2014, 16:38 Subject: Re: [jqueryIntroLoader] Stop at custom time (#1)

Reopened #1. — Reply to this email directly or view it on GitHub.