を使用してコンテンツをロードするページがあります
$('#header').load('head.html')
、しかし、head.html 内のリンクは、website.css が以前にロードされたか、別の理由で私の website.css を使用できません。
だから私はこれを考えまし$('a:hover').css('color','green');
たが、成功しませんでした。
タグで解決できますが、やりたくありません。
アップデート:
base.html
<script>
$('#header').load('/restaurant{{ chosenRest }}.html'); //chosenRest=1,2..etc
</script>
<div id="accordion">
<div id="header" > </div></div>
私はレストラン1.html、レストラン2.htmlのようなファイルを持っています
restaurant1.html
<a href="/Giorgio"> Giorgio's </a>
ウェブサイト.css
a:hover {color:green};
base.html のようなものを追加する
<style> a:hover {color:green; } </style>
と機能しますが、そのようにしたくありません。
更新:最終的に解決
ここで何が機能したか:
base.css新しいクラスを追加しました
.restaurant:a:hover {
color:green;
}
restaurant1.html
<a href="/Giorgio" class="restaurant"> Giorgio's </a>