How can I show the slider onmousedown with handle already pressed
Hi,
I need some help on this one:
I want to show a slider when the user clicks on a certain element. When he does click and holds the mouse button, the slider should fade in immediately with its handle already pressed, so the user will be able to immediately change the value he clicked on. Upon release of the mouse button, the slider will fade out / disappear again.
There are like 30 elements on the page that should be all clickable, all with own values for the slider.
My code so far:
that = $(this) element
e = mousedown function for determining the mouse position
- function showSlider(that,e){
- $('body').append('<div id="slider-range-max"></div>');
- $('#slider-range-max').fadeIn('fast');
- $('#slider-range-max').css('left',e.pageX + 'px').css('top',e.pageY + 'px');
-
- $( "#slider-range-max" ).slider({
- range: "max",
- min: 1,
- max: 10,
- value: 1,
- slide: function( event, ui ) {
- $(that).find('.maxcount').html( ui.value );
- }
- }).trigger('mousedown').mouseup(function(){
- $('#slider-range-max').remove();
- });
- }
PS: I am quite new to jQuery UI and also to jQuery, so maybe I'm missing some major points.
Cheers,
Christian