Skip to content
This repository has been archived by the owner on May 5, 2021. It is now read-only.

Slides stop after changing browser tabs #87

Open
pmichna opened this issue Jan 3, 2017 · 2 comments
Open

Slides stop after changing browser tabs #87

pmichna opened this issue Jan 3, 2017 · 2 comments

Comments

@pmichna
Copy link

pmichna commented Jan 3, 2017

I'm using ideal image slider 1.5.1.

When I open my page, everything is fine. However, when I change browser tab, then go back to the tab with my page, the slides stop changing. There are no errors in the JS console. I checked the issue with Chrome and Firefox.

What could be the problem?

@gfabrizi
Copy link

Same here with chrome 55.0.2883.87 .
Whenever the webpage lost focus (for example if i click on the browser developer's tools) the slider stops (the onStop event is fired). If i'll find out what the problem could be, i'd let you know...

@gfabrizi
Copy link

gfabrizi commented Jan 18, 2017

ok, i've found out a workaround... sorry, i don't know how to commit a change on github...

At line 412 after
nextNavSelector: '',
add this line
stopOnBlur: true,

At line 650 change this

window.onblur = function() {
	this.stop();
}.bind(this);

to this:

if (this.settings.stopOnBlur) {
	window.onblur = function() {
		this.stop();
	}.bind(this);
}

USAGE
Now if you want the slider to keep playing when you change the tab, initialize your slider with the option stopOnBlur set to false:

var slider = new IdealImageSlider.Slider({
       selector: '#sliderHP',
       stopOnBlur: false,
});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants