Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Room A with Capacity for 4 Pax and 1 Adult is required.
- Adult/Child/Infant : 1/0/0 is less than 4 is OK
- Adult/Child/Infant : 2/1/1 is equal to 4 is Ok
- Adult/Child/Infant : 0/2/1 is less than 4 but NO Adult, therefore NOT OK
- $("#mainSlider").slider({
- slide: function(event, ui) {
- //Insert logic here..
- }
- });
- $("#secondarySlider").slider("max", x);
- var sliders = $("#sliders .slider"),
- smax = 4,
- smin = 0;
- sliders.each(function() {
- var availableTotal = smax;
- $(this).empty().slider({
- value: 0,
- // Check - is this the adult slider?
- min: (this.id === 'adult') ? 1 : smin,
- max: smax,
- range: 'min',
- step: 1,
- slide: function(event, ui) {
- // Update display to current value
- $(this).siblings().text(ui.value);
- // Get current total
- var total = 0;
- sliders.not(this).each(function() {
- total += $(this).slider("option", "value");
- });
- // Need to do this because apparently jQ UI
- // does not update value until this event completes
- total += ui.value;
- var max = availableTotal - total;
- // Update each slider
- sliders.not(this).each(function() {
- var t = $(this),
- value = t.slider("option", "value");
- t.slider("option", "max", max + value)
- .siblings().text(value + '/' + (max + value));
- t.slider('value', value);
- });
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement