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

Stop "auto: true" if only one slide #607

Closed
mactedder opened this issue Aug 4, 2014 · 6 comments
Closed

Stop "auto: true" if only one slide #607

mactedder opened this issue Aug 4, 2014 · 6 comments

Comments

@mactedder
Copy link

I have seen numerous comments about this issue, but is there an official fix for this yet? I am do not write Jquery so would need it in plain english.

Basically I need my slideshow to not 'auto' animate if there is only one slide. Currently my slideshow has a fade animation which looks odd when there is only one item in the slideshow.

I am surprised this isn't accounted for in the default code?

@nightgrey
Copy link

If your bxSlider() call looks like this:

$('#slider').bxSlider({
  auto: true
});

you could workaround it like this:

$('#slider').bxSlider({
  auto: ($('#slider').children().length < 2) ? false : true
});

Of course this check had to be in the plugin, but it seems it isn't maintained anymore.

@fedeartica
Copy link

Hi, I have the same issue, I've tried the fix posted by nightowl8: it works when you have only one slide, but if you have 2 or more slides only the first one is visible and the slideshow doesn't work anymore.
Any suggestion please?

@fedeartica
Copy link

nobody? :-(

@nightgrey
Copy link

Hello @fedeartica,
I could have a look if you show your code. You can create a fiddle/pen at http://jsfiddle.net/ or http://codepen.io/.

As this plugin seems to be dead (at least from the maintainer side) I'd suggest using an other slider which is maintained actively. You won't get much support here. I switched to OwlCarousel 2 (which can be used as a carousel or a regular slider), for example, but there are other great sliders out there, it depends heavily on your needs.

@fedeartica
Copy link

Hi,
thanks for your answer.
I've used exactly the same code posted by @NightOwl8

$('#slider').bxSlider({
auto: ($('#slider').children().length < 2) ? false : true
});

It works, but if you insert a second slide the slider shows always one dot.

@Tidal-Wave
Copy link
Collaborator

Related to #712, closing due to duplication of issue and housekeeping. Will address in next update.

As a note: the code presented here doesn't work for 2 slides because you are testing for length < 2 instead of length <= 2.

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

No branches or pull requests

4 participants