javascript highchart photo slide

前端 未结 1 1546
鱼传尺愫
鱼传尺愫 2021-01-24 07:38

I\'m creating a visual chart using the javascript library highchart. Ive created my chart with some fake data. I want to know how to use the chart data to trigger an image slide

相关标签:
1条回答
  • 2021-01-24 08:22

    You can do it by using events.mouseOver and events.MouseOut on your series points: http://api.highcharts.com/highcharts#plotOptions.series.point.events.mouseOver http://api.highcharts.com/highcharts#plotOptions.series.point.events.mouseOut

    Inside its callback function you can trigger 'slide' to your image:

          events: {
                mouseOver: function () {
                    $(".img1").trigger("slideIn");
                },
                mouseOut: function () {
                    $(".img1").trigger("slideOut");
                },
            }
    

    and in your jQuery you can watch for your trigger options, for example:

    $('.img1').on("slideIn", function () {
            $(this).animate({
                opacity: 1,
                left: 155
            });
        });
    
        $('.img1').on("slideOut", function () {
            $(this).animate({
                opacity: 0,
                left: -550
            });
        });
    

    example: http://jsfiddle.net/izothep/gf48mmfa/4/

    0 讨论(0)
提交回复
热议问题