简体   繁体   English

jQuery在Safari中呈现,但不在Chrome中呈现

[英]Jquery renders in Safari but not Chrome

I am using the following code, it renders perfectly in Safari but not in Chrome. 我正在使用以下代码,它可以在Safari中完美呈现,但不能在Chrome中呈现。 I am seeing no errors in the console in Chrome. 我在Chrome的控制台中看不到任何错误。

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>



<!--http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/line-basic/ -->


<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>

<script type="text/javascript">
$(document).ready(function () {
    console.log('inside function');
    $('#container').highcharts({
        title: {
            text: 'Monthly Active Users',
            x: -20 //center
        },
        subtitle: {
            text: 'Users who visited on more than 2 days in the last 30 days',
            x: -20
        },
        xAxis: {
            categories: ["11/09/2016","12/09/2016","13/09/2016","14/09/2016","15/09/2016","16/09/2016","17/09/2016","18/09/2016","19/09/2016","20/09/2016","21/09/2016","22/09/2016",] //insert date here
        },
        yAxis: {
            title: {
                text: 'Percent (%)'
            },
            plotLines: [{
                value: 0,
                width: 1,
                color: '#808080'
            }]
        },
        tooltip: {
            valueSuffix: '%'
        },
        legend: {
            layout: 'vertical',
            align: 'right',
            verticalAlign: 'middle',
            borderWidth: 0
        },
        series: [{
            name: 'Monthly Active Users',
            data: [
            4.2359074617139,4.3266102797658,4.3492372606297,4.3000323310702,4.297253634895,4.1612903225806,4.1867954911433,4.3338683788122,4.3089690392595,4.3795620437956,4.3037974683544,4.294284812125,]
        }]
    });
});
</script>

Here's a perfectly fine working snippet 这是一个完美的工作片段

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"></script> <!--http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/line-basic/ --> <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div> <script type="text/javascript"> $(document).ready(function () { console.log('inside function'); $('#container').highcharts({ title: { text: 'Monthly Active Users', x: -20 //center }, subtitle: { text: 'Users who visited on more than 2 days in the last 30 days', x: -20 }, xAxis: { categories: ["11/09/2016","12/09/2016","13/09/2016","14/09/2016","15/09/2016","16/09/2016","17/09/2016","18/09/2016","19/09/2016","20/09/2016","21/09/2016","22/09/2016",] //insert date here }, yAxis: { title: { text: 'Percent (%)' }, plotLines: [{ value: 0, width: 1, color: '#808080' }] }, tooltip: { valueSuffix: '%' }, legend: { layout: 'vertical', align: 'right', verticalAlign: 'middle', borderWidth: 0 }, series: [{ name: 'Monthly Active Users', data: [ 4.2359074617139,4.3266102797658,4.3492372606297,4.3000323310702,4.297253634895,4.1612903225806,4.1867954911433,4.3338683788122,4.3089690392595,4.3795620437956,4.3037974683544,4.294284812125,] }] }); }); </script> 

with your code that works on Chrome. 与您可在Chrome上运行的代码一起使用。 Could you maybe provide more details about how you're running this and if there are any warnings in the console (not errors) 您能否提供有关运行方式以及控制台中是否有任何警告(不是错误)的更多详细信息

I have just run the code in chrome and it renders just fine. 我刚刚在chrome中运行了代码,它呈现得很好。 I am using chrome version Version 52.0.2743.116 m. 我正在使用Chrome版本52.0.2743.116 m。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM