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

Slider not set position on load inside Bootstrap modal #672

Open
karanvirrkumar opened this issue Jun 26, 2019 · 3 comments
Open

Slider not set position on load inside Bootstrap modal #672

karanvirrkumar opened this issue Jun 26, 2019 · 3 comments

Comments

@karanvirrkumar
Copy link

I have tried many ways earlier of issues that were closed.

My slider psoition is not set on load if it is inisde bootstrap modal. It works if I click on it or resize my screen

I have added a plunkr for a demo. Please check it out and help me out..

https://plnkr.co/edit/espUYkaRlJE7JgtANciF

@karanvirrkumar karanvirrkumar changed the title Slider not set on load inside modal Slider not set position on load inside Bootstrap modal Jun 26, 2019
@ValentinH
Copy link
Member

As explained in other issues and on the "Sliders inside a modal" demo (https://angular-slider.github.io/angularjs-slider/), you need to call $rootScope.$broadcast('rzSliderForceRender'); when the accordion is opening.

@karanvirrkumar
Copy link
Author

I have added `** $rootScope.$broadcast('rzSliderForceRender');** into function and called it on all 3 accordian collapsed divs, it worked but not fully.
please follow the steps as below to find issue:-

  1. open first div - it wont work
    it will make everything fine for 2nd and 3rd div.

  2. click on 2nd div - it will work fine

  3. click on 3rd div - it will work fine but it will ruin everything for 2nd div.

  4. now click on 2nd div (everything ruined).

check this new plunkr after adding $rootscope
https://embed.plnkr.co/HAjNMOnw5ahGDGzMDKcZ/

@salehasadi
Copy link

@officialkansal HI, I know that maybe this is not a good way of handle this but I hope that help because it helped me, I found it accidentallty :-D
call a window resize event with a 500ms or less timeout after on opening the modal and it will work.

setTimeout(() => { window.dispatchEvent(new Event('resize')); // $(window).trigger('resize'); }, 500);

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

3 participants