0

如果我使用“zm”来检查鼠标悬停,这将使用 google 运行而不在 IE 中运行,但如果我使用“z”或“group”来检查鼠标悬停,则脚本将在 IE 上运行,而不是在 Google Chrome 上运行。

并且有一个东西,如果它运行到 IE,他不会在圆形元素上方显示 texto。

这是代码:

var o = {
init: function(){
    this.diagram();
},
random: function(l, u){
    return Math.floor((Math.random()*(u-l+1))+l);
},
diagram: function(){
    var r = Raphael('diagram', 300, 300),
        rad = 73,
        defaultText = '',
        speed = 250;
        cor = "#f1f1f1";
        clicado = "";
        var tempp, tempp2;

    var arco_width = 120; /* Largura do arco */
    var arco_ganho = 135; /* Nova largura quando der Mouse over */
    var arco_espaco = 230; /* espaçamento de um arco para o outro */
    var arco_espaco_unico = 55;
    var alet = 90;/* Angulo de cada parte */

    circulo = r.circle(0, 0, 280).attr({ stroke: 'none', fill: cor/*'#D1D1D1'*/ }); /* '#193340'*/
    foto = r.image("./images/logo-escolaweb-x-75.png", 10, 20, 117, 75);
    c_mask = r.circle(0, 0, 180).attr({ stroke: 'none', fill: 'yellow',  opacity: 0 }); /* '#193340'*/
    //vect = r.r.print(220, 50, "print", r.getFont("Roboto Condensed"), 800).attr({fill: "#fff"});


    /*
    foto.click(function(){
    circulo.attr({ fill: "blue"});
    });*/


    /*var title = r.text(0, 0, defaultText).attr({
        font: '20px Arial',
        fill: '#fff'

    }).toFront();*/

    function menu(atual,cor)
    {

    for (var a=0;a<9;a++)
        { 
            //$("#diagram").css("background-color",color);
            $('.mod').eq(a).css("visibility",'hidden');
            $('.mod').eq(a).css("display",'none');
        }
        //alert("Welcome " + a + ", the ");
        $('.mod').eq(atual).css("display",'inline');
        $('.mod').eq(atual).css("visibility",'visible');
        $('.mod').eq(atual).css("background-color",cor);
    }


    r.customAttributes.arc = function(value, color, rad){
        var v = 3.6*3.25/*value*/,
            alpha = v == 360 ? 359.99 : v,
            random = (-alet),
            a = (random-alpha) * Math.PI/180,
            b = random * Math.PI/180,
            sx = +rad * Math.cos(b),
            sy = -rad * Math.sin(b),
            x =  +rad * Math.cos(a),
            y = -rad * Math.sin(a),
            path = [['M', sx, sy], ['A', rad, rad, 0, +(alpha > 180), 1, x, y]];
        return { path: path, stroke: color,}
    }


    $('.get').find('.arc').each(function(i, ii){
        var t = $(this), 
            color = t.find('.color').val(),
            value = t.find('.percent').val(),
            text = t.find('.text').text(),
            tid = t.find('.pos').val(),
            conteudo = t.find('.conteudo').text();
            alet = ( 9.771* i );

            /*title.rotate(20.25 * i);*/

        rad = arco_espaco;  
        var zm = r.path().attr({ arc: [value, color, rad], 'stroke-width': arco_width, opacity: 0}).toFront();
        var z = r.path().attr({ arc: [value, color, rad], 'stroke-width': arco_width});



        var title = r.text(225, 0, defaultText).attr({
            font: '20px Arial',
            fill: '#999'
            }).toFront();
            title.rotate(10.25*(i+0.40),-1,5);



        var texto = r.text(300, 10,  conteudo).attr({
            font: '20px Arial',
            fill: '#999',
            "text-anchor":"start",
            opacity: 0
            }).toFront();





        var group = r.set();
        group.push(z);
        group.push(title);
        ativo = 1;


        z.mouseover(function(){
            z.animate({ 'stroke-width': arco_ganho, opacity: 0.75 }, 1000, 'elastic');
            if(Raphael.type != 'VML') //solves IE problem
            title.stop().animate({ opacity: 1 }, speed, '>', function(){
                title.attr({ text: text + '\n'}).animate({ opacity: 1 }, 50, '<');
                title.toFront();
            });

            document.body.style.cursor = "pointer";


        z.mouseout(function(){
            z.stop().animate({ 'stroke-width': arco_width, opacity: 1 }, speed*4, 'elastic');
            title.stop().animate({ opacity: 0 }, speed, '>', function(){
                title.attr({ text: defaultText }).animate({ opacity: 0 }, speed, '<');
                title.attr({ text: text + '\n'  }).animate({ opacity: 0, align: left }, speed, '<');
                tempp2 = this;

            }); 
            document.body.style.cursor = "auto";


        });




        z.click(function () {
        $("#diagram").css("background-color",color);
        menu(i,color);

        tempp = temmp2;
        tempp.attr({opacity: 1});
        tempp2.attr({opacity: 1});


        });

        });//MOUSE OVER -FIM

        zm.toFront();
    });


}
}
$(function(){ o.init(); });

结果是一些弧线,当鼠标悬停在上面时,会产生弹性效果 e 显示文本,单击时会更改内容,但我的问题是鼠标悬停到 googlechrome 和 IE 8trash.0

4

1 回答 1

1

我使用以下方法解决了这个问题:

 if(navigator.appName=="Microsoft Internet Explorer") { }

当 IE 执行一个代码时执行另一个代码:)

于 2013-07-29T18:47:42.530 回答