- //是否显示横竖条
- if (this.config["bar_dis"] == true) {
- if (!$("#vline").attr("id")) {
- vLine = "<div id='vline' style='background-color:"+this.config["bar_color"]+";height:100%;width:1px;position:absolute;top:0px;left:" + (_point.x) + "px;'/>";
- $(vLine).appendTo("body");
- } else {
- $(vLine).css("left",(_point.x) + "px");
- vLine.show();
- }
- if (!$("#hline").attr("id")) {
- var hLine = "<div id='hline' style='overflow:hidden;background-color:"+this.config["bar_color"]+";height:1px;width:100%;position:absolute;left:0px;top:" + (_point.y ) + "px;'/>";
- $(hLine).appendTo("body");
- } else {
- $("#hline").css("top",(_point.y ) + "px");
- hLine.show();
- }
- }
- this.hideFocus();
- return true;
- }, hideFocus:function() {//隐藏焦点效果
- if (paper != null) {
- var circle = paper.circle(25, 25, 30);
- circle.attr("stroke", this.config["circle_color"]);
- circle.attr("stroke-width", 1);
- var anim = Raphael.animation({
- r: 5
- }, 900, null, function(){
- this.locationTimer = setTimeout(function(){
- $("#canvas").hide(); //焦点
- $("#vline").hide(); //横条
- $("#hline").hide(); //竖条
- clearTimeout(this.locationTimer);
- }, 500);
- });
- circle.animate(anim);
- } else {
- this.locationTimer = setTimeout(function(){
- $("#canvas").hide(); //焦点
- $("#vline").hide(); //横条 http://www.9oal.com/thread-7636-1-1.html
- $("#hline").hide(); //竖条
- clearTimeout(this.locationTimer);
- }, 500);
- }
- },mousePosition:function (e) {
- var x,y; http://www.9oal.com/forum-37-1.html
- var e = e||window.event;
- return {
- x:e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,
- y:e.clientY+document.body.scrollTop+document.documentElement.scrollTop
- }
- },elementPosition:function( oElement ) {
- var x2 = 0;
- var y2 = 0;
- var width = oElement.offsetWidth;
- var height = oElement.offsetHeight;
- var postion = "";
- if( typeof( oElement.offsetParent ) != 'undefined' ){
- for( var posX = 0, posY = 0; oElement; oElement = oElement.offsetParent ) {
- posX += oElement.offsetLeft;
- posY += oElement.offsetTop;
- }
- x2 = posX + width;
- y2 = posY + height;
- postion = [ posX, posY ,x2, y2];
- } else{
- x2 = oElement.x + width;
- y2 = oElement.y + height;
- postion = [ oElement.x, oElement.y, x2, y2];
- }
- var x = postion[0] + ((postion[2] - postion[0])/2);
- var y = postion[1] + ((postion[3] - postion[1])/2);
- return {"x":x,"y":y};
- }
- }
JS代码 是否显示横竖条
最新推荐文章于 2022-09-05 17:32:35 发布