Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6656645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:40:08+00:00 2026-05-26T01:40:08+00:00

I have made a simple slideshow.. It works like it should exepct when you

  • 0

I have made a simple slideshow.. It works like it should exepct when you tab away and leave the window and tabs back after a while.. Then the slideshow goes crazy like it has stood still and it needs to to keep up with the slides or rolls while the window was in the background.. The slides comes consecutive and after a while goes back to normal

the script:

function Slideshow(){
    var _this = this;

    this.i = 0;
    this.num = 0;

    this.slide = null;
    this.slide_txt_bg = null;
    this.opacity_hover = 0.95;
    this.opacity_hout = 0.5;
    this.opacity_txt_out = 0;
    this.opacity_txt_in = 0.6;
    this.width = 340;
    this.time = 18;
    this.time_clicked = 25;
    this.interval = null;

    this.btn_next = null;
    this.btn_prev = null;

    this.clicked = false;

    this.cnstr = function(){
        this.slide = $('#slideshow_film').detach();
        this.slide_txt_bg = $('#slideshow_txt_bg').css('opacity', this.opacity_txt_in);

        var slideshow = $('#slideshow');
        if(slideshow.length > 0){
            if(this.slide.length > 0){
                var slideshow_inner = $('#slideshow_inner').append(this.slide);
                this.num = this.slide.find('tr')[0].cells.length;

                this.slide.css('width', (this.num * 100)+'%');
                var controls = $('<div class="slideshow_controls"></div>').prependTo(slideshow);
                this.btn_prev = $('<div class="btn_slideshow btn_slideshow_prev"></div>').appendTo(controls)
                    .bind('click', {
                        mode : -1
                    }, this.btn_click)
                    .css('opacity', this.opacity_hout)
                    .mouseover(this.btn_hover)
                    .mouseout(this.btn_hout);
                this.btn_next = $('<div class="btn_slideshow btn_slideshow_next"></div>').appendTo(controls)
                    .bind('click', {
                        mode : 1
                    }, this.btn_click)
                    .css('opacity', this.opacity_hout)
                    .mouseover(this.btn_hover)
                    .mouseout(this.btn_hout);

                this.auto_roll();
            }
            else{
                slideshow.remove();
            }
        }
    };

    this.auto_roll = function(){
        if(this.interval){
            clearInterval(this.interval);
            this.interval = null;
        }
        var time = (this.clicked ? this.time_clicked:this.time) * 1000;
        this.interval = setInterval(function(){
            _this.btn_next.click();
        }, time);
    };

    this.btn_click = function(e){
        _this.txt_bg_out();

        if(e.which){
            _this.clicked = true;
        }
        _this.auto_roll();

        _this.i += e.data.mode;
        if(_this.i < 0){
            _this.i = _this.num - 1;
        }
        else if(_this.i > _this.num - 1){
            _this.i = 0;
        }

        var value = _this.i * _this.width * -1;
        _this.slide.animate({
            left : value+'px'
        }, 800, _this.txt_bg_in);
    };

    this.txt_bg_in = function(){
        _this.slide_txt_bg.delay(500).fadeTo(700, _this.opacity_txt_in);
    };

    this.txt_bg_out = function(){
        _this.slide_txt_bg.fadeTo(300, _this.opacity_txt_out);
    };

    this.btn_hover = function(){
        $(this).fadeTo(300, _this.opacity_hover);
    };

    this.btn_hout = function(){
        $(this).fadeTo(300, _this.opacity_hout);
    };
}

the code:

<div id="slideshow">
    <div id="slideshow_inner">
        <div id="slideshow_txt_bg"></div>
    </div>
</div>

<table id="slideshow_film">
    <tr>
        <td>
            <h1 class="margin:0px">headline</h1>
            <div class="slideshow_img">
                <img src="/gfx/slideshow.email.png" />
            </div>
            <div class="txt txt_box">
                text
            </div>
        </td>
        <td>
            <h1 class="margin:0px">headline</h1>
            <div class="slideshow_img">
                <img src="/gfx/slideshow.bank.png" />
            </div>
            <div class="txt txt_box">
                text
            </div>
        </td>
        <td>
            <h1 class="margin:0px">headline</h1>
            <div class="slideshow_img">
                <img src="/gfx/slideshow.alert.png" />
            </div>
            <div class="txt txt_box">
                text
            </div>
        </td>
        <td>
            <h1 class="margin:0px">headline</h1>
            <div class="slideshow_img">
                <img src="/gfx/slideshow.folders.png" />
            </div>
            <div class="txt txt_box">
                text
            </div>
        </td>
    </tr>
</table>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:40:09+00:00Added an answer on May 26, 2026 at 1:40 am

    I had this problem too a while ago. I solved it by stopping the slideshow on window blur and restarting it on focus:

    jQuery(window).blur(function() {
      // Stop slideshow
    }).focus(function() {
      // Restart slideshow
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made a very simple AppleScript to close tabs in Safari. The problem
I have made a simple auction section on my site, and I would like
I am puzzled by this: I have made a very simple example: MainWindow.xaml: <Window
I have made a simple play/pause button that works in conjunction with the audio
I have made a simple image slideshow using jQuery. I need the next button
I have made a simple test application for the issue, two winforms each containing
I have made my own file type (.ddd) and I made a simple program
I have started using jQuery and rails. I have made a simple form that
I'm just playing around with WPF and MVVM, and I have made a simple
I have a simple nav made up of the following HTML; <div class=inner> <div

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.