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

Slide and 100% #175

Open
bastiangeneugelijk opened this issue Apr 12, 2014 · 8 comments
Open

Slide and 100% #175

bastiangeneugelijk opened this issue Apr 12, 2014 · 8 comments

Comments

@bastiangeneugelijk
Copy link

With the width of a slide on 100%, 'fade' as animtype works perfect, but 'slide' is not working.

@GuiHarrison
Copy link

I would love to be able to do that as well.

@gshilin
Copy link

gshilin commented May 22, 2014

me too

@fului
Copy link

fului commented Jul 12, 2014

I had a bit of the same problem, as I'm using bootstrap and used the 1200 container width, in this case 730px as the bjqs width, but when I would start it at a smaller screen resolution, the images in the slideshow, type slide, would offset, due to the max width being 730px and the actual container being 597px.

I think I have fixed this, but changing a bit of the code in the bjqs file. I changed the initial width from settings.width to responsive.width from line 243, as seen below and until now, I haven't seen any issues with it.

  if(settings.animtype === 'slide'){
    // initial setup
    $slides.css({
        'height'        : settings.height,
        'width'         : responsive.width
    });
    $slides.children('img').css({
        'height'        : settings.height,
        'width'         : responsive.width
    });
    $slider.css({
        'height'        : settings.height,
        'width'         : responsive.width * settings.slidecount
    });
    $wrapper.css({
        'height'        : settings.height,
        'max-width'     : settings.width,
        'position'      : 'relative'
    });

    if(responsive.width < settings.width){

Hope this helps somebody.

@fului
Copy link

fului commented Jul 12, 2014

sorry, right after I posted this, I of course found a bug in my above code, here is how it should look.

$slider.css should still use the settings.width to calculate the full width size, so it is only the two first settings that need to change.

if(settings.animtype === 'slide'){
    // initial setup
    $slides.css({
        'height'        : settings.height,
        'width'         : responsive.width
    });
    $slides.children('img').css({
        'height'        : settings.height,
        'width'         : responsive.width
    });
    $slider.css({
        'height'        : settings.height,
        'width'         : settings.width * settings.slidecount
    });
    $wrapper.css({
        'height'        : settings.height,
        'max-width'     : settings.width,
        'position'      : 'relative'
    });

    if(responsive.width < settings.width){

@fului
Copy link

fului commented Jul 12, 2014

so I again found an issue with my above solution, on resizing from big to smaller screen sizes, as it seems that the settings.slidecount, does not exist, it is called state.slidecount.

here is the new full code, from line 243 to 314 in the bjqs file.

            if(settings.animtype === 'slide'){

                // initial setup
                $slides.css({
                    'height'        : settings.height,
                    'width'         : responsive.width
                });
                $slides.children('img').css({
                    'height'        : settings.height,
                    'width'         : responsive.width
                });
                $slider.css({
                    'height'        : settings.height,
                    'width'         : responsive.width * state.slidecount
                });
                $wrapper.css({
                    'height'        : settings.height,
                    'max-width'     : settings.width,
                    'position'      : 'relative'
                });

                if(responsive.width < settings.width){

                    $slides.css({
                        'height'        : responsive.height
                    });
                    $slides.children('img').css({
                        'height'        : responsive.height
                    });
                    $slider.css({
                        'height'        : responsive.height
                    });
                    $wrapper.css({
                        'height'        : responsive.height
                    });

                }

                $(window).resize(function() {

                    // calculate and update dimensions
                    responsive.width    = $wrapper.outerWidth(),
                    responsive.ratio    = responsive.width/settings.width,
                    responsive.height   = settings.height * responsive.ratio;

                    $slides.css({
                        'height'        : responsive.height,
                        'width'         : responsive.width
                    });
                    $slides.children('img').css({
                        'height'        : responsive.height,
                        'width'         : responsive.width
                    });
                    $slider.css({
                        'height'        : responsive.height,
                        'width'         : responsive.width * state.slidecount
                    });
                    $wrapper.css({
                        'height'        : responsive.height
                    });
                    $canvas.css({
                        'height'        : responsive.height,
                        'width'         : responsive.width
                    });

                    resize_complete(function(){
                        go(false,state.currentslide);
                    }, 200, "some unique string");

                });

            }

This now seems to be working in all resize tests for me.

@lindaweinmer
Copy link

THANK YOU! You saved my day!

@panda7789
Copy link

Lot of thanks for ya :)

@nadira84
Copy link

so I again found an issue with my above solution, on resizing from big to smaller screen sizes, as it seems that the settings.slidecount, does not exist, it is called state.slidecount.

here is the new full code, from line 243 to 314 in the bjqs file.

            if(settings.animtype === 'slide'){

                // initial setup
                $slides.css({
                    'height'        : settings.height,
                    'width'         : responsive.width
                });
                $slides.children('img').css({
                    'height'        : settings.height,
                    'width'         : responsive.width
                });
                $slider.css({
                    'height'        : settings.height,
                    'width'         : responsive.width * state.slidecount
                });
                $wrapper.css({
                    'height'        : settings.height,
                    'max-width'     : settings.width,
                    'position'      : 'relative'
                });

                if(responsive.width < settings.width){

                    $slides.css({
                        'height'        : responsive.height
                    });
                    $slides.children('img').css({
                        'height'        : responsive.height
                    });
                    $slider.css({
                        'height'        : responsive.height
                    });
                    $wrapper.css({
                        'height'        : responsive.height
                    });

                }

                $(window).resize(function() {

                    // calculate and update dimensions
                    responsive.width    = $wrapper.outerWidth(),
                    responsive.ratio    = responsive.width/settings.width,
                    responsive.height   = settings.height * responsive.ratio;

                    $slides.css({
                        'height'        : responsive.height,
                        'width'         : responsive.width
                    });
                    $slides.children('img').css({
                        'height'        : responsive.height,
                        'width'         : responsive.width
                    });
                    $slider.css({
                        'height'        : responsive.height,
                        'width'         : responsive.width * state.slidecount
                    });
                    $wrapper.css({
                        'height'        : responsive.height
                    });
                    $canvas.css({
                        'height'        : responsive.height,
                        'width'         : responsive.width
                    });

                    resize_complete(function(){
                        go(false,state.currentslide);
                    }, 200, "some unique string");

                });

            }

This now seems to be working in all resize tests for me.

Yes! It works! Thanks.

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

No branches or pull requests

7 participants