Question

I have sort of a image carousel which automatically and on hover swaps image thumbs with a big image header. And this is working perfectly, but now I have realized that I want to add some indication to each thumb currently displayed. I thought I could apply div.container img.current and give it some properties, values.. but it did not work.

So I thought I could ask you all for a good valid quick solution.

Here is my code

<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>
Was it helpful?

Solution

use j-query toggleClass() function

here is an example

<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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top