Difference between revisions of "Adapt highlighting of objects"

From JSXGraph Wiki
Jump to: navigation, search
Line 1: Line 1:
 
<html>
 
<html>
<div id="myinfobox"
 
    style="
 
        zIndex:99;
 
        display:none;
 
        top:0px;
 
        left:0px;
 
        position:absolute;
 
        background-color:#ffff88;
 
        padding:10px;
 
        /*width:50px;*/
 
        /* Cross-browser opacity: */
 
        -ms-filter:'progid:DXImageTransform.Microsoft.Alpha(Opacity=50)';
 
        filter: alpha(opacity=50);
 
        opacity:.5;
 
    "
 
></div>
 
</html>
 
 
<jsxgraph width="600" height="600">
 
<jsxgraph width="600" height="600">
 
var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-5, 5, 5, -5], grid: false});
 
var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-5, 5, 5, -5], grid: false});
Line 26: Line 9:
  
 
var c = brd.create('circle',[p2,p3]);
 
var c = brd.create('circle',[p2,p3]);
var infobox = document.getElementById('myinfobox');
+
var infobox = brd.create('text',[0,0,'xxx'],{visible:false});
 +
 
 
JXG.Line.prototype.highlight = function(){
 
JXG.Line.prototype.highlight = function(){
     infobox.innerHTML = this.name;
+
     //infobox.plainTextStr = this.name;
     infobox.style.left = (this.board.mousePosAbs[0]+20)+'px';
+
     //infobox.setPosition = (this.board.mousePosAbs[0]+20)+'px';
     infobox.style.top = (this.board.mousePosAbs[1]-20)+'px';
+
     //infobox.style.top = (this.board.mousePosAbs[1]-20)+'px';
     infobox.style.display = 'block';
+
     infobox.setProperty({visible:true});
 
}
 
}
 
JXG.Line.prototype.noHighlight = function(){
 
JXG.Line.prototype.noHighlight = function(){
     infobox.style.display = 'block';
+
     infobox.setProperty({visible:false});
 
}
 
}
 +
/*
 
c.highlight = function(){
 
c.highlight = function(){
 
     infobox.innerHTML = 'circle '+this.name;
 
     infobox.innerHTML = 'circle '+this.name;
Line 45: Line 30:
 
     infobox.style.display = 'none';
 
     infobox.style.display = 'none';
 
}
 
}
 +
*/
 
</jsxgraph>
 
</jsxgraph>
  

Revision as of 17:27, 18 December 2009

<html>

The JavaScript code