loopj / jquery-simple-slider

Unobtrusive numerical slider plugin for jQuery
194 stars 113 forks source link

Width #15

Open Vivek44 opened 11 years ago

Vivek44 commented 11 years ago

How to set Width to the Input Slide..?

maartenvg commented 11 years ago

The simple-slider.css that comes with the script contains

.slider {
  width: 300px;
}

You can change or override that to fit your needs.

ivus commented 11 years ago

I found a positioning problem with the script. If I changed the width of the dragger, it would move the vertical position higher than the track which was undesirable. Looking at the code I was able to do a simple fix.

line 63 : change from

  this.dragger.css({
    marginTop: this.dragger.outerWidth() / -2,
    marginLeft: this.dragger.outerWidth() / -2
  });

To

  this.dragger.css({
    marginTop: this.dragger.outerHeight() / -2,
    marginLeft: this.dragger.outerWidth() / -2
  });

so that the marginTop is referencing the objects Height rather than it's Width.

Seems to have fixed the issue.

blueskysd commented 10 years ago

@ivus - Thanks! I ran into the same problem with the width issue you found. You might want to post it as a separate issue so that @loopj might fix it.