pixedelic / Camera

http://www.pixedelic.com/plugins/camera/
494 stars 309 forks source link

no slideding if only one image #40

Open micker opened 10 years ago

micker commented 10 years ago

hello how to stop sliding effect if only one item in slideshow thanks

cazzoo commented 10 years ago

Hi,

I experience that issue too while having only 1 image on my slideshow (automatic generation). For now, the slideshow slides like if there are two images but the second is white.

The only solution I found is not to activate the slideshow when I got only one image. It would be good to have this handled by camera.

Regards

schipa commented 9 years ago

I'm using following workaround for slideshows with just one slide - automatic generation as well:

jQuery(slideshow_selector).camera({
    autoAdvance: false,
    mobileAutoAdvance: false,
    navigation: false,
    playPause: false
});

Thus I get that pretty design but this one slide will not advance and no buttons are visible on hover (therefore not accessible). Unfortunately mobile devices are still able to advance/swipe the slide manually when jquery.mobile.customized.min.js is included.

jeremymouton commented 9 years ago

I ran into this issue as well and decided to fork the repo and fix it. If anyone is interested: https://github.com/jeremymouton/Camera/commit/c913a6771106c6184f4f2109f255b2e3a009324f

gwatsima commented 9 years ago

If i may ask and I'm a novice/still learning. What is the use of only using one image in a slide it sort of beats the purpose of a slide don't you think, why not just use a regular image and make it beautiful or is it the beauty of the slide layout that is alluring. please educate me.

jeremymouton commented 9 years ago

@gwatsima, you are right, there is no real value in using a slider for just one image. It would look strange if it rotated by itself every couple seconds.

Though depending on the project, a slider may need to support one or multiple images. If there's only one image, we want to pause or disable the slider so it doesn't slide; and if there are multiple we want the slideshow to start like it would normally.

I needed camera.js to support that scenario, so I setup a fallback to pause the slideshow if only one image is present (as well as hide the pagination dots).

The script is more flexible this way, and behaves properly regardless of how many images are present.

Hope this answers your question.

gwatsima commented 9 years ago

Okay i hear you @jeremymouton, but to tell you the truth i find camera.js to be a little bit tricky for me, i don't know maybe its just me. It works perfectly on some of my sites but refuse completely on others. Maybe i need to understand it more.

gwatsima commented 9 years ago

Could you have a solution to this, one of my sites has the logo displaying small because i was constrained by the size of the header div, i don't want to make it bigger but i want the logo to be bigger. The problem I'm encountering is that when i try to adjust the logo it displaces everything below it. Is there a way i can display the logo to overlay the banner div without displacing it. www.leadtimecargo.co.ke

A good example of this is on this website: http://www.chatelaincargo.com Look at the way the logo overlaps the banner.

gwatsima commented 9 years ago

I got a solution thanks

mtsweir commented 7 years ago

@schipa has a good work around for this and seems to work fine for me.

You'd still require a few other slider settings though, I found that 'height' and 'loader' where the bare minimum for me to get the slider to actually work. Cheers for posting your solution.