FhHRx

如何实现提交后页面加载中loading锁定页面Ajax通过Jquery

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

 

将下列代码加入CSS中

.modal {
display: none;
position: fixed;
z-index: 1000;
top: 0;
left: 0;
height: 100%;
width: 100%;
background: rgba( 255, 255, 255, .8 )
url('http://xxxxx/xxxxx.gif')
50% 50%
no-repeat;
}
/* loading时候页面锁定 */
body.loading {
overflow: hidden;
}
/* loading时候页面锁定,显示modal部分 */
body.loading .modal {
display: block;
}

注意将url(‘http://xxxxx/xxxxx.gif’)中的链接换成你要选用的加载中的动画gif图片,例如下面的这张:
FhHRx

最后, 通过body的加载和删除loading class来控制loading的gif动画锁定。
比如将
$body = $("body");$body.addClass("loading");
放置在发送请求之前。 并将
$body = $("body");$body.removeClass("loading");
放置在接受到请求之后。

也可以尝试以下演示:

$body = $("body");
$(document).on({
ajaxStart: function() { $body.addClass("loading"); },
ajaxStop: function() { $body.removeClass("loading"); }
});

Read More

highstock example

Setting Individual Point color in Series for Highstock API

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

I was working on Highstock, I tried to set a color to a specific point in “data” in Highstock, like in the example,the example is implemented using Highchart API,but I couldn’t get it to work with Highstock API, no matter how I set the color, it doesn’t show on the graph.

Thanks for stackoverflow, someone helped me.


It’s important to put marker enable in the plotOptions, otherwise it won’t work.

 plotOptions: {
        series: {
            marker: {
                enabled: true    
            }
        }
    },
$(function () {
    var seriesSetting=[{name:"aaa",
            data: [{x: 1343862840000,y: 4.447361},{x:1343863200000,y:5,marker:{fillColor:'red'}},{x:1343873200000,y:8}]
        }];
    var chart = new Highcharts.StockChart({
        useUTC:false,
                showLoading:"loading",
                chart:{
                    renderTo:'container',
                    type:'spline',
                    events:{
                        load: function(chart) {
                            this.setTitle(null, {
                                text: 'Built chart at '+ (new Date() - start) +'ms'
                            });
                        }

                    }
                },
                legend:{
                    enabled:true,
                    showInLegend:true,
                    layout:'vertical',
                    align:'right',
                    verticalAlign:'top',
                    x:-10,
                    y:100,
                    borderWidth:0
                },
                rangeSelector:{
                    enabled:false
                },         
                xAxis:{
                    title:{
                        text:'time'
                    },

                    //    tickLength:100,
                    ordinal: false,
                    type:'datetime',
                },
                tooltip:{
                    shared:false,
                    shadow:false,
                    style:{
                        //  color:'#333333',
                        fontSize:'9pt',
                        padding:'5px'
                    }
                },
                yAxis:{
                    title:"value"
                },
                plotOptions:{
                    series:{turboThreshold: 99999,  marker: {
                           enabled: true
                       }
                    }},
                series:seriesSetting
    });
});

Read More

Get URL request parameter with jQuery (Javascript)

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

Here is an example of how to get URL request parameters in Javascript (Jquery)

http://www.leonli.co.uk?search=parameters
        function getURLParameter(name) {
            return decodeURI(
                    (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
            );
        }
 var parameter=url.getURLParameter("search"); 

Read More