[英]JavaScript changes font-weight for no reason?
Got a bit of a weird issue with a site I'm working on. 我正在处理的网站有一个奇怪的问题。 When I load the homepage my fonts found within the navigation and headings seem to loose some font-weight for some reason.
当我加载主页时,由于某种原因,在导航和标题中发现的字体似乎失去了一些字体粗细。 I've managed to narrow it down to a small piece of javascript that only loads on the homepage, when removed all my fonts are nice and fat.
我设法将其缩小为一小段javascript,仅将其加载到首页上,删除后我所有的字体都很好。
In the javascript (made for a slider) it doesn't mention h tags at all, or anything to do with font-weight. 在javascript(专为滑盖设计)中,它根本没有提及h标签,或者与font-weight有关。 But yet it still seems to be effecting it.
但是它似乎仍在影响它。
Here's the JS, if anyone can see why this might be happening? 这是JS,如果有人可以看到为什么会这样呢?
var sliderActive = $("#wrapper #slider-single")
sliderActive.not(":first").removeClass("active");
sliderActive.on("hover", function() {
sliderActive.removeClass("active");
$(this).addClass("active");
});
That's it. 而已。 Like I say, if I remove this file the fonts are fine.
就像我说的,如果删除此文件,字体就可以了。 No idea why :S
不知道为什么:S
The CSS for the class active affects the slider you see here: http://ember.lukeseager.com 活动类的CSS会影响您在此处看到的滑块: http : //ember.lukeseager.com
.active .each {
background-color: rgba(0,0,0,.1);
-moz-transition: .3s ease; -webkit-transition: .3s ease;
-o-transition: .3s ease; -ms-transition: .3s ease; transition: .3s ease;
}
.active .home_video {
top: 0px;
z-index: 0;
}
Any info you guys have would be amazing! 你们拥有的任何信息都将是惊人的! Thanks!
谢谢!
EDIT: Testing this across browsers, it seems to just be an issue on Chrome (only tested on Mac so far). 编辑:跨浏览器进行测试,这似乎只是Chrome上的问题(到目前为止,仅在Mac上进行了测试)。 Maybe it's just a browser rendering issue?
也许仅仅是浏览器渲染问题?
It's likely that the CSS class .active
is defined to have another font-weight. CSS类
.active
可能已定义为具有另一个font-weight。 SO when you add that class, the font-weight changes. 因此,当您添加该类时,字体粗细会发生变化。 Please double check your CSS via a Code Inspector after the script was executed.
执行脚本后,请通过代码检查器仔细检查CSS。
It's in the http://ember.lukeseager.com/wp-content/themes/ember/css/reset.css file: 在http://ember.lukeseager.com/wp-content/themes/ember/css/reset.css文件中:
h1, h2, h3, h4, h5, h6 { font-size:100%; font-weight:normal }
UPDATE: 更新:
Are you sure it's font-weight you're talking about, and not font-size? 您确定它在说的是字体粗细而不是字体大小吗? typography.css contains:
typography.css包含:
.slider-heading { font-size: 1em !important; }
The !important
flag makes this override the following from layout.css: !important
标志使它覆盖layout.css中的以下内容:
.each h2 { font-size: 18px; .each h2 {font-size:18px; }
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.