Skip to main content

Search and Top Navigation

#9424 closed bug (notabug)

Opened July 12, 2013 11:50AM UTC

Closed July 12, 2013 02:52PM UTC

Last modified July 12, 2013 02:57PM UTC

$('.ui-slider-handle:first').offset() incorrect if hidden

Reported by: warmski Owned by: warmski
Priority: minor Milestone: none
Component: ui.slider Version: 1.10.3
Keywords: Cc:
Blocked by: Blocking:
Description

Similar to ticket 2428. If the slider is in a hidden div when created it creates the handles in the right place but does not set the correct offset values. The code I am using is:

$('#slider').slider({

min:0,

max:1000000,

step:5000,

values: [100000, 500000],...

var handle1x = $('.ui-slider-handle:first').offset().left;

When visible on create handle1x is 115

When hidden on create handle1x is -1.

Thanks

Attachments (0)
Change History (4)

Changed July 12, 2013 12:28PM UTC by tj.vantoll comment:1

owner: → warmski
status: newpending

Are you trying to get the offset while the slider is still hidden? jQuery has never supported this.

If not could you please create a test case that shows this. You can use this as a starting point: http://jsfiddle.net/tj_vantoll/Hd4Ca/.

Thanks.

Changed July 12, 2013 02:37PM UTC by warmski comment:2

status: pendingnew

Ahh okay. I am trying to set a highlighter between two handles (as in the link http://jsfiddle.net/warmski/Hd4Ca/14/). The whole section is collapsed (hidden) until the user clicks expand. In the example the highlighting works great once the change / slide event is triggered. It also works great if the slider isn't hidden on create.

Any suggestions for a workaround, other than to quickly display the slider, set it up then hide it?

Thanks

Changed July 12, 2013 02:52PM UTC by tj.vantoll comment:3

resolution: → notabug
status: newclosed

Replying to [comment:2 warmski]:

Ahh okay. I am trying to set a highlighter between two handles (as in the link http://jsfiddle.net/warmski/Hd4Ca/14/). The whole section is collapsed (hidden) until the user clicks expand. In the example the highlighting works great once the change / slide event is triggered. It also works great if the slider isn't hidden on create. Any suggestions for a workaround, other than to quickly display the slider, set it up then hide it? Thanks

It looks like you're trying to recreate the built in functionality a range slider provides: http://jsfiddle.net/tj_vantoll/r87b8/.

Changed July 12, 2013 02:57PM UTC by warmski comment:4

D'oh! I had three handles originally and so couldn't use range but now I have two I can. Oh well a fun afternoon getting used to jQuery UI. Thanks for such a speedy response and your help.