使用Jquery按价格范围搜索属性

时间:2012-12-17 04:01:20

标签: php javascript jquery wordpress

我正在尝试按价格范围搜索房产。我已将My php和Jquery附加到搜索选项。目前,金额显示没有逗号和货币符号,如此10000000-100000000。但我想将其改为1,000,000-100,000卢比。我怎样才能做到这一点。如果您需要Click here才能查看网站。

  <script type="text/javascript">       
            jQuery(document).ready(function(){

            /*-----------------------------------------------------------------------------------*/
            /*  Search Slider in Footer -- Settings can be changed from theme options
            /*-----------------------------------------------------------------------------------*/
                <?php 
                if( function_exists( 'ot_get_option' ))
                {                                           
                    ?>
                    var min_val = parseInt(<?php echo ot_get_option( 'min_val', 0 ); ?>);
                    var max_val = parseInt(<?php echo ot_get_option( 'max_val', 1000000 ); ?>);
                    var ini_min_val = parseInt(<?php echo ot_get_option( 'ini_min_val', 100000 ); ?>);
                    var ini_max_val = parseInt(<?php echo ot_get_option( 'ini_max_val', 500000 ); ?>);
                    var step = parseInt(<?php echo ot_get_option( 'step', 5000 ); ?>);
                    <?php
                }
                else
                {
                    ?>
                    var min_val = 0;
                    var max_val = 1000000;
                    var ini_min_val = 100000;
                    var ini_max_val = 500000;
                    var step = 5000;
                    <?php
                }
                ?>


                $("#slider-range").slider({
                    range: true,
                    min: min_val,
                    max: max_val,
                    values: [ ini_min_val, ini_max_val ],
                    step: step,
                    slide: function( event, ui ) {
                        $( "#min-price" ).val( ui.values[ 0 ]);
                        $( "#max-price" ).val( ui.values[ 1 ]);
                        $( "#amount" ).val( ui.values[ 0 ] + " - " + ui.values[ 1 ] );
                    }
                });

                $( "#amount" ).val( $( "#slider-range" ).slider( "values", 0 ) + " - " + $( "#slider-range" ).slider( "values",1 ) );

                $( "#min-price" ).val( $( "#slider-range" ).slider( "values", 0 ) );
                $( "#max-price" ).val( $( "#slider-range" ).slider( "values", 1 ) );
            });         
            </script>

2 个答案:

答案 0 :(得分:1)

使用JQuery滑块的http://egorkhmelev.github.com/jslider/插件,它提供数字格式和货币..

答案 1 :(得分:-1)

你试过这个吗?

                var min_val = $0;
                var max_val = $1000000;
                var ini_min_val = $100000;
                var ini_max_val = $500000;
                var step = $5000;