English 中文(简体)
Jquery slider将标签贴在价值观上
原标题:Jquery slider allocate label words to values

这里的问题有:。 是的,还是没有节点或斜线,但可以找到这一榜样中的工作解决办法。

我有横向增量幅度的梯度,我想加以修改,以便贴上小中型的标签——数值1 - 2 - 3

我试图坚持一个阵列,但我可以让它工作。

在这方面,我迄今为止已经:

    <script>
        $(function() {
            $( "#slider-range" ).slider({
                range: true,
                min: 1,
                max: 3,
                step: 1,
                values: [ 2, 3 ],
                slide: function( event, ui ) {
                    $( "#amount" ).val( ui.values[ 0 ] + " - " + ui.values[ 1 ] );
                }
            });
            $( "#amount" ).val( $( "#slider-range" ).slider( "values", 0 ) +
                " - " + $( "#slider-range" ).slider( "values", 1 ) );
        });
    </script>

因此,如果选择2 - 3个职位(如缺省),则标签为中型——大体。

任何帮助或方向都会受到高度赞赏。

增 编

最佳回答

What about this?

它使用一个地图标,而不是一个阵列,但也包括一个功能,使浮标恢复,而不是制造:

$(function() {

    // mapper    
    var valueMap = {
        1 : "small",
        2 : "medium",
        3 : "large",
        getText : function(arr) {
            return this[arr[0]] + " - " + this[arr[1]];
        }
    };

    // initial range slider values
    var initial = [2, 3];

    // initialize slider
    $( "#slider-range" ).slider({
        range: true,
        min: 1,
        max: 3,
        step: 1,
        values: initial,
        slide: function( event, ui ) {
            $("#amount").val(valueMap.getText(ui.values));
        }
    });

    // initialize value display
    $("#amount").val(valueMap.getText(initial));

});
问题回答

暂无回答




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签