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 stuck and not centered when use fade in - fade out #515

Closed
johnico opened this issue Mar 27, 2017 · 6 comments
Closed

Slider stuck and not centered when use fade in - fade out #515

johnico opened this issue Mar 27, 2017 · 6 comments

Comments

@johnico
Copy link

johnico commented Mar 27, 2017

Steps to reproduce

  1. i have empty page from directive A with some css
  2. after its remove the css of empty page it just fade in/fade out a class ("element" .class="page") the page class contain the sliders
  3. the slider are stuck to left even the value is 1.15 . until click on them and then they are go back to the center.

without fadein/fadeout . the sliders works great

thx for support

code directive A :

if(scope.emptyStatus == true)
            {
              $("#page").css('display','none');
              angular.element('html').css('background-image', 'url(\'' + "bg.jpg"+ '\')');

            }
            else {
              $(element).css('display','none');
            }

after some action:

  $('#emptyStatus').fadeOut(500);
                      angular.element('html').css('background-image', 'url(\'' + "bg.jpg"+ '\')');
                      $("#page").fadeIn(500);
                      scope.emptyStatus = false;

page controller:

        vm.brightSlider = {
          value: 1.15,
          options: {
             floor: 0.3,
             ceil: 2,
             step: 0.05,
             precision: 2,
            showSelectionBarFromValue: 1.15
          }
        };

slider code:

        <div class="brightnessSlider">
                      <rzslider rz-slider-model="vm.brightSlider.value"
                      rz-slider-options="vm.brightSlider.options"></rzslider>
                    </div>
@ValentinH
Copy link
Member

ValentinH commented Mar 27, 2017

Also, handling show/hide of element via jQuery is not really the way to go with Angular. You should use ng-show or ng-if for that purpose, along with CSS transition if you need fading. This would not fix your issue but it would avoid future issues.

http://stackoverflow.com/a/22428497/1713469

@johnico
Copy link
Author

johnico commented Mar 27, 2017

thx . but how do I do the "click" on refreshSlider without ng-show or ng click
because i dont need ng click or ng show , it should upload without it

@johnico
Copy link
Author

johnico commented Mar 27, 2017

and I cant remove the fade in jquery now because its feature that working good for me :)

the fade in/out make the problem i guess but i cant replace it

@ValentinH
Copy link
Member

You don't have to click on vm.refreshSlider but just call it like vm.refreshSlider() when you show the slider.

My remark about fading is just an advice for writing better Angular apps, but it's not the reason of your issue.

@johnico
Copy link
Author

johnico commented Mar 28, 2017

thx a lot

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