使用jquery更改样式段落的属性

时间:2018-02-13 15:19:10

标签: jquery css3

我有以下风格:

set.seed(12345)
HSMiss <- HolzingerSwineford1939[ , paste("x", 1:9, sep = "")]
HSMiss$x5 <- ifelse(HSMiss$x1 <= quantile(HSMiss$x1, .3), NA, HSMiss$x5)
HSMiss$x9 <- ifelse(is.na(HSMiss$x5), NA, HSMiss$x9)
HSMiss$school <- HolzingerSwineford1939$school

HS.model <- '
visual  =~ x1 + a*x2 + b*x3
textual =~ x4 + x5 + x6
x7 ~ textual + visual + x9
'

group1 <- subset(HSMiss, school =='Pasteur')
group2 <- subset(HSMiss, school =='Grant-White')

imputed.group1 <- mice(group1, m = 3, seed = 12345) 
imputed.group2 <- mice(group2, m = 3, seed = 12345) 


 #attempted merging:
    imputed.both <- nrow(complete(rbind(imputed.group1, imputed.group2)))

我将如何改变,例如jquery的字体粗细?我不清楚调用的语法。会不会是

#menu-content p
{
font-family: Verdana, sans-serif;
font-variant: small-caps;
font-size: 2.5vmin;
font-weight: 100;
}

$("#menu-content p").css ("font-weight", "150");

我试过了两个;似乎都不起作用。

2 个答案:

答案 0 :(得分:0)

你需要更改它以便visible effect - 然后你的第一次调用是正确的,假设在调用时页面中存在被访问的元素:

$(function() { // when page has loaded - you might have missed this 
  setTimeout(function() { // just for the demo
    $("#menu-content p").css ("font-weight", "550"); 
    $("#menu-content p").html("Now font-weight: 550")
  },2000);
});  
#menu-content p {
  font-family: Verdana, sans-serif;
  font-variant: small-caps;
  font-size: 10vmin 1rem;
  font-weight: 100;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Wait 2 secs
<div id="menu-content"><p>Initial font-weight: 100</p></div>

答案 1 :(得分:-3)

您只能更改唯一ID:

$("#menu-content").css("font-weight", "150");