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

Swiper not showing up until screen is resized #34

Open
jishnupradeep opened this issue Aug 30, 2018 · 2 comments
Open

Swiper not showing up until screen is resized #34

jishnupradeep opened this issue Aug 30, 2018 · 2 comments

Comments

@jishnupradeep
Copy link

Hi,
I am trying to make a web app that uses Swiper. I found that Swiper is not showing up until the page is resized. How to fix this issue?

@joakimkm
Copy link

joakimkm commented Aug 31, 2018

I am not sure if your problem is similar, but I had this problem because Swiper was added inside a modal. The problem happen because Swiper is running init-functions when modal is closed and width is 0 px. To solve this problem I added this attributte to swiper element:

on-Init="onInit"

And in my scope controller I added this:

$scope.onInit = function (swiper) {
        $('#myBootstrapModalElement').on('shown.bs.modal', function(){
            swiper.onResize();
        });
 };

This will trigger swipers resize function after modal is opened.

@jishnupradeep
Copy link
Author

Thank you @joakimkm ! This tweak works.

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

2 participants