klox7 VIP
Total posts: 914
21 Нояб 2014 15:42

I'm using BXSlider for my gallery and there seems to be a "Issue" if there is only 1 image. BXSlider loops images but if there is only 1 image this is not neccessary.

Regards

Последние изменения: 19 Дек 2014


pepperstreet VIP
Total posts: 3,837
23 Нояб 2014 16:52

Good point. Found a similar issue on BXslider GitHub project. Maybe the answer will help you...


klox7 VIP
Total posts: 914
23 Нояб 2014 17:20

Yes and also thumbnails have no meaning if there is only one picture.

I tried your link but somehow I didn't manage to do it.

I was also trying with this but auto and pager are from first values always

<script type="text/javascript">
    jQuery(document).ready(function(){
        var slider = '#galleria<?php echo $key?>';
        if(jQuery(slider).length <= 1) {
            jQuery(slider).bxSlider({
                mode: 'fade',
                auto: false,
                autoControls: false,
                adaptiveHeight: false,
                pagerCustom: '#bx-pager<?php echo $this->id; ?>',
                captions: true,
                pager: false
            });
        } else {
            jQuery(slider).bxSlider({
                mode: 'fade',
                auto: true,
                autoControls: false,
                adaptiveHeight: true,
                pagerCustom: '#bx-pager<?php echo $this->id; ?>',
                captions: true,
                pager: true
            });
        }
    });
</script>

Sergey
Total posts: 13,748
24 Нояб 2014 08:05

Added changes to next version acording your example.


klox7 VIP
Total posts: 914
24 Нояб 2014 08:46

Sergey Added changes to next version acording your example.

No Sergey, this code is not working for me!!! I don't know what's the problem. But the idea was to remove pager and auto scroll if image is only 1.


klox7 VIP
Total posts: 914
24 Нояб 2014 10:49

This now works but pager still shows a little bit but I think is css issue. Please test first.

<script type="text/javascript">
    if(jQuery('#galleria<?php echo $key?> .slide').length <= 1) {
        jQuery('#galleria<?php echo $key?>').bxSlider({
            mode: 'fade',
            auto: false,
            autoControls: false,
            adaptiveHeight: false,
            pagerCustom: '#bx-pager<?php echo $this->id; ?>',
            captions: true,
            pager: false
        });
    } else {
        jQuery('#galleria<?php echo $key?>').bxSlider({
            mode: 'fade',
            auto: true,
            autoControls: false,
            adaptiveHeight: true,
            pagerCustom: '#bx-pager<?php echo $this->id; ?>',
            captions: true,
            pager: true
        });
    }
</script>

klox7 VIP
Total posts: 914
24 Нояб 2014 14:03

New problem. I'm using bxslider in bootstrap tabs and with upper code this tabs are not working.


Sergey
Total posts: 13,748
28 Нояб 2014 02:49

I added changes. Pager is not there if there is only one image.


klox7 VIP
Total posts: 914
05 Дек 2014 09:08

Can you also please remove the loop if one image?


Sergey
Total posts: 13,748
08 Дек 2014 08:36

You mean auto: true,?


klox7 VIP
Total posts: 914
08 Дек 2014 10:01

Yes, I think is this parameter.


Sergey
Total posts: 13,748
09 Дек 2014 03:01

Ok. DOne.


Konstantin
Total posts: 1,113
17 Дек 2014 05:58

What problem?


Sergey
Total posts: 13,748
19 Дек 2014 05:16

Or yes. I m ssed echo. Should be:

<?php echo count($this->value) > 1 ? 'true' : 'false'; ?>
Работает на Cobalt