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

Question : why ticks label are not in the tick HTML element ? #910

Open
Pontax opened this issue Jan 22, 2019 · 2 comments
Open

Question : why ticks label are not in the tick HTML element ? #910

Pontax opened this issue Jan 22, 2019 · 2 comments

Comments

@Pontax
Copy link

Pontax commented Jan 22, 2019

Hello,
My problem is that I'm in horizontal orientation and I would like to adapt the slider's width to the parent.
So, I've set the width to 100% but the tick' labels have a calculated width in px and before a click or a window resize, labels are wrong-positioned, while ticks a well positioned.

After looking at source code, I have a question : why the HTML element corresponding to the label is not inside the HTML element representing the tick ?

@seiyria
Copy link
Owner

seiyria commented Jan 22, 2019

Try calling refresh on the slider instance after resizing is done.

@Pontax
Copy link
Author

Pontax commented Jan 22, 2019

OK, I have called the refresh method on the window.load event.
I could tell that it's working but I have a blinking display : labels are shown at a first position, then the refresh occurs and move the labels at their right positions.

Why don't you instantiate the slider on this event ?
This way, the size of elements is known and tick labels will be well positioned.

var self = this;
$(window).load(function(){
    instance = new PluginClass( self, options );
    $.data( self, namespace, instance );
});

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