社区
JavaScript
帖子详情
VML z-index 问题
jonefy
2012-01-04 03:05:45
我试图做一个圆环的效果,将一个<v:oval的圆放置在两个报表中间!
我试图将一个 <v:oval 显示在由 <v:shape 和<v:Rect 生成的饼状报表下
但是我设置z-index 为-1 则在最底下,设置为正数则显示在最上层
望各位不吝赐教!
...全文
115
6
打赏
收藏
VML z-index 问题
我试图做一个圆环的效果,将一个<v:oval的圆放置在两个报表中间! 我试图将一个 <v:oval 显示在由 <v:shape 和<v:Rect 生成的饼状报表下 但是我设置z-index 为-1 则在最底下,设置为正数则显示在最上层 望各位不吝赐教!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
6 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
d2648189399
2012-11-28
打赏
举报
回复
function SVGRenderer()
{
this.svgRoot = null;
}
SVGRenderer.svgNamespace = 'http://www.w3.org/2000/svg';
SVGRenderer.prototype.init = function(elem)
{
this.container = elem;
this.container.style.MozUserSelect = 'none';
var container_all = document.getElementsByTagName("svg");
if (container_all.length !=0)
{
this.svgRoot = container_all[0];
}
else
{
this.svgRoot = this.container.ownerDocument.createElementNS(SVGRenderer.svgNamespace, "svg");
this.svgRoot.style.position = 'absolute';
this.container.appendChild(this.svgRoot);
}
}
SVGRenderer.prototype.addArrowColor = function(color)
{
var elem = this.container.ownerDocument.getElementById(color);
if(elem)
{
return;
}
var defs = this.container.ownerDocument.createElementNS(SVGRenderer.svgNamespace, "defs");
this.svgRoot.appendChild(defs);
var marker = this.container.ownerDocument.createElementNS(SVGRenderer.svgNamespace, "marker");
marker.setAttributeNS(null, 'id', color);
marker.setAttributeNS(null, 'viewBox', '0 0 30 30');
marker.setAttributeNS(null, 'refX', 0);
marker.setAttributeNS(null, 'refY', "15px");
marker.setAttributeNS(null, 'markerUnits', 'strokeWidth');
marker.setAttributeNS(null, 'markerWidth', "9px");
marker.setAttributeNS(null, 'markerHeight', "30px");
marker.setAttributeNS(null, 'orient',"auto");
defs.appendChild(marker);
var path = this.container.ownerDocument.createElementNS(SVGRenderer.svgNamespace, "path");
path.setAttributeNS(null, 'd',"M 0 0 L 30 15 L 0 30 Z");
path.setAttributeNS(null, 'fill',color);
path.setAttributeNS(null, 'stroke',color);
path.setAttributeNS(null, 'stroke-width',"1px");
marker.appendChild(path);
}
SVGRenderer.prototype.drawArrow = function(left, top, left1, top1,color)
{
top +=9;
this.addArrowColor(color);
var svg;
svg = this.container.ownerDocument.createElementNS(SVGRenderer.svgNamespace, 'line');
svg.style.position = 'absolute';
svg.setAttributeNS(null, 'x1', left + "px");
svg.setAttributeNS(null, 'y1', top + "px");
svg.setAttributeNS(null, 'x2', left1 + "px");
svg.setAttributeNS(null, 'y2', top1 + "px");
svg.setAttributeNS(null, 'stroke', color);
svg.setAttributeNS(null, 'stroke-width', "1px");
svg.setAttributeNS(null, 'fill', color);
svg.setAttributeNS(null, 'marker-end', "url(#"+color+")");
this.svgRoot.appendChild(svg);
return svg;
}
SVGRenderer.prototype.remove = function(shape)
{
shape.parentNode.removeChild(shape);
}
SVGRenderer.prototype.move = function(shape, left, top)
{
if (shape.tagName == 'line')
{
var deltaX = shape.getBBox().width;
var deltaY = shape.getBBox().height;
shape.style.position = 'absolute';
shape.setAttributeNS(null, 'x1', left);
shape.setAttributeNS(null, 'y1', top);
shape.setAttributeNS(null, 'x2', left + deltaX);
shape.setAttributeNS(null, 'y2', top + deltaY);
}
}
function VMLRenderer()
{
}
VMLRenderer.prototype.init = function(elem)
{
this.container = elem;
this.container.style.overflow = 'hidden';
// Add VML includes and namespace
elem.ownerDocument.namespaces.add("v", "urn:schemas-microsoft-com:vml");
var style = elem.ownerDocument.createStyleSheet();
style.addRule('v\\:*', "behavior: url(#default#VML);");
}
VMLRenderer.prototype.drawArrow = function(left,top,left1,top1,color)
{
var line = this.container.ownerDocument.createElement('v:line');
line.style.position = 'absolute';
line.setAttribute('from', left + 'px,' + top + 'px');
line.setAttribute('to', left1 + 'px,' + top1 + 'px');
line.setAttribute('strokecolor',color);
var arrow = this.container.ownerDocument.createElement('v:stroke');
arrow.setAttribute('Endarrow', "Classic");
line.appendChild(arrow);
this.container.appendChild(line);
return line;
}
VMLRenderer.prototype.remove = function(shape)
{
shape.removeNode(true);
}
VMLRenderer.prototype.move = function(shape, left, top)
{
if (shape.tagName == 'line')
{
shape.style.marginLeft = left;
shape.style.marginTop = top;
}
else
{
shape.style.left = left;
shape.style.top = top;
}
}
VMLRenderer.prototype.resize = function(shape, fromX, fromY, toX, toY)
{
var deltaX = toX - fromX;
var deltaY = toY - fromY;
if (shape.tagName == 'line')
{
shape.setAttribute('to', toX + 'px,' + toY + 'px');
}
else
{
if (deltaX < 0)
{
shape.style.left = toX + 'px';
shape.style.width = -deltaX + 'px';
}
else
{
shape.style.width = deltaX + 'px';
}
if (deltaY < 0)
{
shape.style.top = toY + 'px';
shape.style.height = -deltaY + 'px';
}
else
{
shape.style.height = deltaY + 'px';
}
}
}
function FlowGraphic(elem)
{
if(!elem)
{
elem = document.body;
}
ie = navigator.appVersion.match(/MSIE (\d\.\d)/);
opera = (navigator.userAgent.toLowerCase().indexOf("opera") != -1);
if ((!ie) || (opera))
{
this.render = new SVGRenderer();
}
else
{
this.render = new VMLRenderer();
}
this.render.init(elem);
this.container = elem;
}
FlowGraphic.prototype.drawArrow = function(x1,y1,x2,y2,color)
{
color = color||"black";
return this.render.drawArrow(x1,y1,x2,y2,color);
}
FlowGraphic.prototype.drawExceptionLine = function(x1,y1,x2,y2)
{
return this.drawArrow(x1,y1,x2,y2,"red");
}
FlowGraphic.prototype.drawLine = function(x1,y1,x2,y2)
{
return this.drawArrow(x1,y1,x2,y2);
}
d2648189399
2012-11-28
打赏
举报
回复
请问怎么解决让这条线放在图片上啊?
jonefy
2012-01-04
打赏
举报
回复
问题已解决! 我在最上层的饼状报表上加了一个和它样式一样的iframe并且隐藏它!
谢谢MuBeiBei 热心回答! 结贴给分!
MuBeiBei
2012-01-04
打赏
举报
回复
[Quote=引用 2 楼 jonefy 的回复:]
引用 1 楼 mubeibei 的回复:
z-index只对绝对定位管用。
在加上position:absolute;把这两个饼图
设置的都是position:absolute;
[/Quote]
那你就让在上面的数值大一些,下面的用1就行了,别用-1,这样试试~·
jonefy
2012-01-04
打赏
举报
回复
[Quote=引用 1 楼 mubeibei 的回复:]
z-index只对绝对定位管用。
在加上position:absolute;把这两个饼图
[/Quote]
设置的都是position:absolute;
MuBeiBei
2012-01-04
打赏
举报
回复
z-index只对绝对定位管用。
在加上position:absolute;把这两个饼图
开发过程中遇到的浏览器兼容的
问题
总结
本文详细介绍了如何在IE浏览器中实现CSS3圆角效果及透明度
问题
的解决方法,包括使用
VML
矢量可标记语言、Web行为脚本文件和CSS3属性的使用技巧。同时强调了在实现过程中需要注意的关键点,如绝对定位、
z-index
属性的设置以及不同浏览器的兼容性
问题
。
让IE6/IE7/IE8浏览器支持CSS3属性
本文介绍了如何通过.ie-css3.htc文件让IE浏览器支持CSS3的一些属性,如border-radius和box-shadow。.htc文件实际上是JavaScript脚本的一种形式,结合
VML
(矢量标记语言),在IE中实现类似CSS3的效果。使用时需注意元素定位和
z-index
。尽管这种方法存在局限性,但能解决IE浏览器对CSS3不支持的
问题
。
怎么让html5浏览器兼容ie8,怎么让ie8兼容css3?
本文列举了多种使Internet Explorer浏览器支持CSS3属性的工具和方法,包括Dean Edwards的IE7.js、eCSStender、DD_roundies、border-radius.htc、ie-css3.htc、ie-css3.js、cssSandpaper和css3PIE.htc。重点介绍了css3PIE.htc的使用步骤和注意事项,如
z-index
问题
、路径
问题
、缩写限制以及Content-Type设置。这些工具通过不同的技术手段,如
VML
和滤镜,实现了在IE中模拟CSS3的效果,尽管存在局限性,但有助于提升IE浏览器的CSS3兼容性。
css pie.htc使用总结
本文探讨了使用pie.htc让IE支持CSS3特性的方法及常见
问题
,包括
z-index
失效、路径
问题
、缩写限制与Content-Type配置,提供了解决方案。
VML
标记与通用属性
本文详细介绍了
VML
标记的使用方法,包括其基本语法、通用属性、HTML和CSS通用属性的支持情况。探讨了
VML
图形的描述方式,边框、颜色、大小等属性的设置,以及如何利用HTML和CSS属性增强
VML
图形的表现力。
JavaScript
87,990
社区成员
224,684
社区内容
发帖
与我相关
我的任务
JavaScript
Web 开发 JavaScript
复制链接
扫一扫
分享
社区描述
Web 开发 JavaScript
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章