# Bootstrap-session-timeout

## Custom Callback

Shows an example of using custom callback functions for warning and redirect.

### Session Status:

Session is fine.

Warning: session will expire in less than 17 seconds.

                $.sessionTimeout({
                    keepAliveUrl: 'keep-alive.html',
                    logoutUrl: 'login.html',
                    warnAfter: 3000,
                    redirAfter: 20000,
                    onStart: function () {
                        $('.jumbotron').css('background', '#398439').find('p').addClass('hidden');
                        $('#fine').removeClass('hidden')
                    },
                    onWarn: function () {
                        $('.jumbotron').css('background', '#b92c28').find('p').addClass('hidden');
                        $('#warn').removeClass('hidden')
                    },
                    onRedir: function (opt) {
                        window.location = opt.logoutUrl;
                    }
                });

Back to Demo Index