test basic highlighting - svg does not seem to allow a class attr..

This commit is contained in:
Sanj 2011-06-24 21:38:29 +05:30
parent ba079a4ae9
commit 23e38e90e4
2 changed files with 28 additions and 7 deletions

View File

@ -4,3 +4,7 @@
position: absolute;
display: none;
}
.highlighted {
font-weight: bold;
}

View File

@ -1,8 +1,10 @@
var R;
$(function() {
$.getJSON("radia.json", {}, function(data) {
R = data;
var $texts = [];
$('text').each(function() {
var $tspan = $(this).children('tspan').eq(0);
var key = $.trim($tspan.text());
@ -13,7 +15,7 @@ $(function() {
$this.data("name", thisData.name);
$this.data("type", thisData.type);
$this.data("link", thisData.link);
$this.addClass(thisData.type);
$this.tooltip({
'delay': 0,
'showURL': false,
@ -21,17 +23,31 @@ $(function() {
return $(this).data("name");
}
});
/*
$texts.push($this);
$this.mouseover(function(e) {
var tooltipText = $(this).data("name");
// console.log(tooltipText);
$('#tooltip').text(tooltipText).css({'left': e.clientX + "px", "top": e.clientY + "px"}).show();
var typ = $(this).data("type");
for (var i=0; i<$texts.length;i++) {
var $t = $texts[i];
if ($t.data("type") == typ) {
$t.css({'fontWeight': 'bold'});
}
}
// $('.' + cls).addClass("highlighted");
// console.log($('.' + cls).length);
});
$this.mouseout(function(e) {
$('#tooltip').hide();
var typ = $(this).data("type");
for (var i=0; i<$texts.length;i++) {
var $t = $texts[i];
if ($t.data("type") == typ) {
$t.css({'fontWeight': 'normal'});
}
}
// $('.' + cls).removeClass("highlighted");
});
*/
$this.click(function() {
console.log($(this).data("link"));
});
@ -39,3 +55,4 @@ $(function() {
});
});
});