[英]applying current class css to images
我有一種圖像輪播,它可以自動並懸停地將圖像拇指與大圖像標題交換。 並且它運行良好,但是現在我意識到我想向當前顯示的每個拇指添加一些指示。 我以為可以使用div.container img.current並為其提供一些屬性,值..但是它沒有用。
所以我想我可以要求大家提供一個有效的快速解決方案。
這是我的代碼
<div class="container-thumbs">
<div class="big-image-thumbnail">
<a href=".html"onmouseover="document.getElementById('bigImage').src='.jpg'">
<img src=".jpg" /></a><p>Title</p>
</div>
使用j-query toggleClass()函數
這是一個例子
<head>
<style>
p { margin: 4px; font-size:16px; font-weight:bolder;
cursor:pointer; }
.blue { color:blue; }
.highlight { background:yellow; }
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<p class="blue">Click to toggle</p>
<p class="blue">highlight</p>
<p class="blue">on these</p>
<p class="blue">paragraphs</p>
<script>
$("p").click(function () {
$(this).toggleClass("highlight");
});
</script>
</body>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.