【问题标题】:Jquery renders in Safari but not ChromeJquery 在 Safari 中呈现,但在 Chrome 中不呈现
【发布时间】:2016-09-23 04:58:25
【问题描述】:

我正在使用以下代码,它在 Safari 中完美呈现,但在 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>

【问题讨论】:

  • Chrome 有什么问题?截屏?或者请提供演示链接。

标签: javascript jquery google-chrome safari


【解决方案1】:

这是一个完美的工作 sn-p

<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>

使用适用于 Chrome 的代码。您能否提供有关您如何运行它以及控制台中是否有任何警告(不是错误)的更多详细信息

【讨论】:

    【解决方案2】:

    我刚刚在 chrome 中运行了代码,它渲染得很好。我使用的是 chrome 版本 52.0.2743.116 m。

    【讨论】:

    • 是的,它在 chrome 中工作。这应该是评论而不是答案
    • 我之前没有足够的权限来添加评论。我是stackoverflow的新手,就在几秒钟前,我的一个答案被赞成了,所以现在可以发表评论了。此外,我还必须提供一个图像,以便查看渲染图像和控制台。
    猜你喜欢
    • 2021-04-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-22
    • 2012-12-19
    • 1970-01-01
    • 2014-02-15
    • 1970-01-01
    相关资源
    最近更新 更多