Показать сообщение отдельно
  #3 (permalink)  
Старый 22.12.2014, 18:30
Профессор
Отправить личное сообщение для ufaclub Посмотреть профиль Найти все сообщения от ufaclub
 
Регистрация: 27.11.2010
Сообщений: 202

Сообщение от nimensy Посмотреть сообщение
присоединяюсь к вопросу.

Еще интересно как менять параметры внутри maphilight при клике.

Обращение
X.data-maphilight="XXX"
не работает.


jQuery(document).ready(function(){







	

	var R = Raphael("mapPaper1", 980, 463);
	
var i = 1,
    area = {};	
	

	var oAreas1 = jQuery("#mapPaper1 .mapArea1");
   	
	jQuery.each(oAreas1, function(){
        area[i] = R.path(jQuery(this).attr("data-path")).attr(JSON.parse("{"+jQuery(this).attr("status-path")+"}"));
    i++;
});
    
    jQuery('#mapPaper1 path').each(function(i,el){
       
    jQuery(this).qtip({
	content:{text:jQuery(el).find('title').text()},
	  position: {
	         my: 'center left',  // Position my top left...
             target: 'mouse', // Track the mouse as the positioning target
             adjust: { x: 20, y: 10 } // Offset it slightly from under the mouse
         }
	});
	
    });
	
    
    jQuery('#mapPaper1 a').each(function(i,el){jQuery(el).attr('class','test');})
	

	for (var j=1; j<i; j++) {
		(function (o, j) {
			o[0].style.cursor = "pointer";
			o[0].onmouseover = function () {
			
              /*   jQuery(this).data('originalColor',jQuery(this).attr('fill'));
				var color = "#FCE588";
				o.animate({fill:color}, 50); */
			    o.animate({opacity:0.7}, 150);
				
			};
			o[0].onmouseout = function () {
			
			/* 	var color = jQuery(this).data('originalColor');
				o.animate({fill: color}, 50); */
			o.animate({opacity:0.99}, 150);
			
			};
			o[0].onclick = function () {
				var color = "#F00";
				o.animate({fill: color}, 50);
			};
		})(area[j], j);
	}
	


});



посмотри нижнюю часть кода

o[0].onclick = function () {
				var color = "#F00";
				o.animate({fill: color}, 50);
			};


и как она вызывается. я на основе этого и сделал смену цвета при клике. (ну там уже что угодно сделать можно)
Ответить с цитированием