Jquery ToggleClass未调整段落大小

Jquery ToggleClass未调整段落大小,jquery,toggleclass,Jquery,Toggleclass,我很难让jQuery的ToggleClass增加和减少我的“p”字体大小。单击增加图标时,我希望我的段落文本“id=#text”的字体大小增加16px,再次单击图标时减少14px。我认为实现这一目标的最佳方法是使用jQuery的ToggleClass,但它似乎工作不正常。 欢迎提出任何建议或解决方案,并表示感谢 jQuery代码: $(function(){ $(".large-type").live("click",function(){ $("#text").toggleClas

我很难让jQuery的ToggleClass增加和减少我的“p”字体大小。单击增加图标时,我希望我的段落文本“id=#text”的字体大小增加16px,再次单击图标时减少14px。我认为实现这一目标的最佳方法是使用jQuery的ToggleClass,但它似乎工作不正常。 欢迎提出任何建议或解决方案,并表示感谢

jQuery代码:

$(function(){
  $(".large-type").live("click",function(){
    $("#text").toggleClass("large");
  });
});
HTML5代码:

<p id="text">
    MANHATTAN, KAN - The Longhorns, three games into their defense of the No. 1 ranking, come to  a place where the opponent is formidable, the crowd is raucous, and the reference might just wear out their whistles.<br><br> They come to face No. 13 Kansas State, an in-your-face team that reflects the personality of its coach, Frank Martin. The wildcats spend much of their games fouling and shooting free throws.<br><br>All 12,528 tickets have been sold, and coach Rick Barnes hopes the Longhorns can summon the fortitude Texas A&M showed in the packed Erwin Center on Saturday during a 72-67 loss to the Longhorns in overtime.<br><br>"It's gonna be flipped Monday," Barnes said. "We're not gonna have the house. I hope we go in with the same intensity A&M brought."<br><br>Kansas State has 13 consecutive victories at home, its longest streak in Manhattan since winning 20 straight in 1981-82.<br><br>The Longhoorns and Wildcats would not be called rivals, but you couldn't tell by their games in recent seasons.<br><br>Barnes is 8-4 against Kansas State. The Longhorns have won four of the last six, but five of those games were decided by four points or fewer. Texas has won the last two in Manhattan. K-State has a two-game winning steak in Austin.
</p>

曼哈顿,堪萨斯州——长角队在第1名的防守中进行了三场比赛,他们来到了一个对手令人生畏、观众喧闹的地方,他们的口哨可能会磨坏。

他们面对的是第13号堪萨斯州,一支直面球队,反映了其教练弗兰克·马丁的个性。野猫队大部分比赛时间都是犯规和罚球。

所有12528张球票都已经售出,教练里克·巴恩斯希望长角队能像周六在加时赛中72-67输给长角队时在拥挤的欧文中心所表现出的那样坚韧。

巴恩斯说:“这将在周一被取消。”。“我们不会拥有这所房子。我希望我们能以A&M带来的同样强度进入比赛。”

堪萨斯州在主场取得了13场连胜,这是自1981-82年连续20场获胜以来曼哈顿最长的连胜。

长角兽队和野猫队不会被称为对手,但是你不能从他们最近几个赛季的比赛中看出。巴恩斯在对堪萨斯州的比赛中以8-4获胜。长角队在过去六场比赛中赢了四场,但其中五场比赛以四分或更少的比分获胜。德克萨斯州在曼哈顿赢得了最后两个冠军。肯塔基州在奥斯汀有一块两局获胜的牛排。


类与CSS属性值不同。 因此,您需要在CSS中为“大”类定义字体大小属性,以使其正常工作:

.large{font-size: large;}

在css中定义以下内容可以解决您的问题

#text { font-size:14px}
#text.large{ font-size:16px}

你能发布你的CSS吗?“工作不正常”是什么意思?谢谢你解决了这个问题。