- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
IE 似乎在来自未压缩的 raphaeljs 1.4.7 的以下第 2207 行(当然,在我的代码的上下文中):
gs.left != (t = left + "px") && (gs.left = t);
我不熟悉这种情况下的 != 语法,所以我发现很难弄清楚发生了什么或者为什么 IE 可能对此不满意。我已经在 IE6 和 IE8 以及 OSX 上的 Chrome 和 Firefox 中进行了测试。当然,如果在 FF 中出现问题,我会逐步使用 Firebug ...
你能告诉我这条线试图达到什么目的吗,更好的是,你能看出为什么 IE 可能会出现问题吗?
对于您的上下文,这是包含该行的完整方法:
Element[proto].setBox = function (params, cx, cy) {
if (this.removed) {
return this;
}
var gs = this.Group.style,
os = (this.shape && this.shape.style) || this.node.style;
params = params || {};
for (var i in params) if (params[has](i)) {
this.attrs[i] = params[i];
}
cx = cx || this._.rt.cx;
cy = cy || this._.rt.cy;
var attr = this.attrs,
x,
y,
w,
h;
switch (this.type) {
case "circle":
x = attr.cx - attr.r;
y = attr.cy - attr.r;
w = h = attr.r * 2;
break;
case "ellipse":
x = attr.cx - attr.rx;
y = attr.cy - attr.ry;
w = attr.rx * 2;
h = attr.ry * 2;
break;
case "image":
x = +attr.x;
y = +attr.y;
w = attr.width || 0;
h = attr.height || 0;
break;
case "text":
this.textpath.v = ["m", round(attr.x), ", ", round(attr.y - 2), "l", round(attr.x) + 1, ", ", round(attr.y - 2)][join](E);
x = attr.x - round(this.W / 2);
y = attr.y - this.H / 2;
w = this.W;
h = this.H;
break;
case "rect":
case "path":
if (!this.attrs.path) {
x = 0;
y = 0;
w = this.paper.width;
h = this.paper.height;
} else {
var dim = pathDimensions(this.attrs.path);
x = dim.x;
y = dim.y;
w = dim.width;
h = dim.height;
}
break;
default:
x = 0;
y = 0;
w = this.paper.width;
h = this.paper.height;
break;
}
cx = (cx == null) ? x + w / 2 : cx;
cy = (cy == null) ? y + h / 2 : cy;
var left = cx - this.paper.width / 2,
top = cy - this.paper.height / 2, t;
gs.left != (t = left + "px") && (gs.left = t);
gs.top != (t = top + "px") && (gs.top = t);
this.X = pathlike[has](this.type) ? -left : x;
this.Y = pathlike[has](this.type) ? -top : y;
this.W = w;
this.H = h;
if (pathlike[has](this.type)) {
os.left != (t = -left * zoom + "px") && (os.left = t);
os.top != (t = -top * zoom + "px") && (os.top = t);
} else if (this.type == "text") {
os.left != (t = -left + "px") && (os.left = t);
os.top != (t = -top + "px") && (os.top = t);
} else {
gs.width != (t = this.paper.width + "px") && (gs.width = t);
gs.height != (t = this.paper.height + "px") && (gs.height = t);
os.left != (t = x - left + "px") && (os.left = t);
os.top != (t = y - top + "px") && (os.top = t);
os.width != (t = w + "px") && (os.width = t);
os.height != (t = h + "px") && (os.height = t);
}
};
最佳答案
这行代码没有任何问题——假设定义了 gs.left
和 left
。它相当于:
t = left + 'px';
if (gs.left != t) gs.left = t;
“窒息”到底是什么意思?
关于javascript - (gs.left != (t = left + "px") && (gs.left = t);) 是做什么的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3254407/
我正在上 codeschool,他们告诉我: SORRY, TRY AGAIN transform must be defined last, after the browser prefix sty
我正在使用 SCSS 更改 bootstrap 4 的样式以创建我自己的样式,但是当我编译 SCSS 时出现此错误: { "status": 1, "file": "H:/!WEBSITE/m
在将作为 photoshop 文件给出的网页设计转换为 html+css 时,我对字体大小感到困惑。如下图所示,photoshop 中的 30 px 不等于其他 Windows 程序(Mac 或其他程
关闭。这个问题是opinion-based .它目前不接受答案。 想要改进这个问题? 更新问题,以便 editing this post 可以用事实和引用来回答它. 关闭 6 年前。 Improve
在我当前的代码中,ul 一直放在页面底部,超过了我的预定义框。 我尝试使用 position:fixed 和 bottom:0 .box { width: 900px; height:
我在 photoshop 中有一个模型,其字体为 60px。我将浏览器中的字体设置为相同的 60px 大小,但浏览器中的字体较小。知道这是为什么吗? 最佳答案 您在 Photoshop 中为您的文本启
我想知道是否有可能仅使用 CSS 获取页面的浏览器/视口(viewport)像素尺寸并将其显示在页面上(最好使用“内容”样式)。我正在为我的一个元素(完全用 CSS 构建)这样做。我知道使用 JS 很
我正在尝试将可变数量的像素计算为与密度无关的像素,反之亦然。 这个公式 (px to dp): dp = (int)(px/(displayMetrics.densityDpi/160)); 不适用于
我在一个带有 1px 边框的容器中有两个 div。我希望每个 div 按宽度正好占据容器的一半,所以我尝试使用 CSS3 的 calc函数从总宽度 (50%) 中减去预定的像素值(2px,div 的每
我正在使用 em 但在嵌套元素中遇到问题所以我决定使用 % 作为 yui建议。 To change the size of a font, always use percentages as the
我有一个元素容器。我想为容纳元素的容器设置最大高度,但如果元素没有填满整个尺寸,则让容器降低其高度。是否可以通过 CSS 实现? 最佳答案 也许使用height: auto。请显示您的 CSS 和 H
我刚刚开始使用 sprites 来减少 HTTP 请求,我在将处理悬停动画的旧脚本转换到新系统时遇到了一些问题。我真的不想为每个按钮设置一个单独的功能,因为这很痛苦,尤其是按钮的数量,即使复制和粘贴也
我正在从头开始创建一个 HTML 页面,并在其中动态放置值,然后将其显示在 WebView 中。 我正在尝试在 WebView(作为 HTML)中复制 ActionBar(出现在应用程序的其他 Act
我希望“蓝色”容器始终为 70 像素高,而之前的“绿色”div 在使用 javascript 调整 div 大小时始终最大化可用高度。 我已经尝试了一段时间,但没有找到合适的解决方案。我们将不胜感激。
我在 Quora 上阅读了以下内容: By setting the font-size of the (which by default its 16px) to 62.5%, setting em
我在关于 http://developer.android.com/guide/practices/screens_support.html 的一些不幸的歧义中迷失了方向,而且我找不到澄清问题的 st
有什么区别: border-right: 1px dotted #CCCCCC; 和: border-right: 1 px dotted #CCCCCC; 有没有? 第二个不正确吗?你需要在 px
我想创建(某种)全 Angular slider ,其中我有一个带有多个子部分的柔性包装器。每个部分100vw排成一排。现在我想每次单击按钮时都将 Flex-wrapper 的 margin-left
在这样的代码中: var a = e.clientX; var b = document.getElementById('someElement').style.left; var z = a - b
我有一个非常简单的表单,其中包含一个 和一个 . 这是 HTML: body { font-family: sans-serif; } input { border: none; out
我是一名优秀的程序员,十分优秀!