<bdo id='qsb43'></bdo><ul id='qsb43'></ul>

    <legend id='qsb43'><style id='qsb43'><dir id='qsb43'><q id='qsb43'></q></dir></style></legend>

    <i id='qsb43'><tr id='qsb43'><dt id='qsb43'><q id='qsb43'><span id='qsb43'><b id='qsb43'><form id='qsb43'><ins id='qsb43'></ins><ul id='qsb43'></ul><sub id='qsb43'></sub></form><legend id='qsb43'></legend><bdo id='qsb43'><pre id='qsb43'><center id='qsb43'></center></pre></bdo></b><th id='qsb43'></th></span></q></dt></tr></i><div id='qsb43'><tfoot id='qsb43'></tfoot><dl id='qsb43'><fieldset id='qsb43'></fieldset></dl></div>
  1. <small id='qsb43'></small><noframes id='qsb43'>

      <tfoot id='qsb43'></tfoot>

    1. jQuery UI 组合滑块百分比

      jQuery UI combined slider percentage(jQuery UI 组合滑块百分比)
        <tbody id='IdVQc'></tbody>

      • <tfoot id='IdVQc'></tfoot>

        <small id='IdVQc'></small><noframes id='IdVQc'>

      • <legend id='IdVQc'><style id='IdVQc'><dir id='IdVQc'><q id='IdVQc'></q></dir></style></legend>

            • <bdo id='IdVQc'></bdo><ul id='IdVQc'></ul>
            • <i id='IdVQc'><tr id='IdVQc'><dt id='IdVQc'><q id='IdVQc'><span id='IdVQc'><b id='IdVQc'><form id='IdVQc'><ins id='IdVQc'></ins><ul id='IdVQc'></ul><sub id='IdVQc'></sub></form><legend id='IdVQc'></legend><bdo id='IdVQc'><pre id='IdVQc'><center id='IdVQc'></center></pre></bdo></b><th id='IdVQc'></th></span></q></dt></tr></i><div id='IdVQc'><tfoot id='IdVQc'></tfoot><dl id='IdVQc'><fieldset id='IdVQc'></fieldset></dl></div>
                本文介绍了jQuery UI 组合滑块百分比的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我已经采用了这个例子,并在上面添加了 5 个滑块.

                I have taken this example and added 5 sliders on it.

                示例:http://jsfiddle.net/redsunsoft/caPAb/2/
                我的例子:http://jsfiddle.net/9azJG/

                    var sliders = $("#sliders .slider");
                    var availableTotal = 100;
                
                    sliders.each(function() {
                        var init_value = parseInt($(this).text());
                
                        $(this).siblings('.value').text(init_value);
                
                        $(this).empty().slider({
                            value: init_value,
                            min: 0,
                            max: availableTotal,
                            range: "max",
                            step: 2,
                            animate: 0,
                            slide: function(event, ui) {
                
                                // Update display to current value
                                $(this).siblings('.value').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 delta = availableTotal - total;
                
                                // Update each slider
                                sliders.not(this).each(function() {
                                    var t = $(this),
                                        value = t.slider("option", "value");
                
                                    var new_value = value + (delta/2);
                
                                    if (new_value < 0 || ui.value == 100) 
                                        new_value = 0;
                                    if (new_value > 100) 
                                        new_value = 100;
                
                                    t.siblings('.value').text(new_value);
                                    t.slider('value', new_value);
                                });
                            }
                        });
                    });
                

                当存在五个滑块时,每次拖动滑块时,jQuery 滑块都会以一种奇怪的方式做出反应.似乎目标滑块的值在每一步都变为零并返回到原始值.

                When there are five sliders present, the jQuery sliders react in a weird way each time the sliders are dragged. It seems like the value for the target sliders goes to zero and back to the original value on each step.

                有谁知道是什么导致了这个问题?我一直在寻找几个小时没有任何想法.

                Would anyone know what causes this issue? I have been searching for hours without any idea.

                推荐答案

                delta/n where n = { 主滑块下的滑块数 }

                delta/n where n = { number of sliders that are under the main slider }

                var new_value = value + (delta/4);
                

                演示

                这篇关于jQuery UI 组合滑块百分比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                append() 方法在被选元素的结尾(仍然在内部)插入指定内容。 语法: $(selector).append( content ) var creatPrintList = function(data){ var innerHtml = ""; for(var i =0;i data.length;i++){ innerHtml +="li class='contentLi'"; innerHtml +="a href
                问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                Ordinals in words javascript(javascript中的序数)
                    <bdo id='Ge4Ua'></bdo><ul id='Ge4Ua'></ul>

                        <tbody id='Ge4Ua'></tbody>

                        <tfoot id='Ge4Ua'></tfoot>

                        <small id='Ge4Ua'></small><noframes id='Ge4Ua'>

                        <legend id='Ge4Ua'><style id='Ge4Ua'><dir id='Ge4Ua'><q id='Ge4Ua'></q></dir></style></legend>

                        <i id='Ge4Ua'><tr id='Ge4Ua'><dt id='Ge4Ua'><q id='Ge4Ua'><span id='Ge4Ua'><b id='Ge4Ua'><form id='Ge4Ua'><ins id='Ge4Ua'></ins><ul id='Ge4Ua'></ul><sub id='Ge4Ua'></sub></form><legend id='Ge4Ua'></legend><bdo id='Ge4Ua'><pre id='Ge4Ua'><center id='Ge4Ua'></center></pre></bdo></b><th id='Ge4Ua'></th></span></q></dt></tr></i><div id='Ge4Ua'><tfoot id='Ge4Ua'></tfoot><dl id='Ge4Ua'><fieldset id='Ge4Ua'></fieldset></dl></div>