I want to change the opacity of other elements on a hover using jQuery on my Wordpress site.
Here is an example: http://www.casinotitan.im/ (firefox gives the best result)
<div class="container">
<div class="example">
<img src="example.png" alt=".." class="img-example" />
</div>
<div class="example">
<img src="example.png" alt=".." class="img-example" />
</div>
<div class="example">
<img src="example.png" alt=".." class="img-example" />
</div>
I also want to insert this script into a Wordpress page (my homepage), but I don't understand what the procedure is to get jQuery up and running.
This should do the job:
$(".example").hover(function() {
$(".example").not($(this)).toggleClass("translucent");
});
CSS:
.translucent {
opacity: 0.2;
}
You can see it in action at: http://jsfiddle.net/sUnh8/1/
Check the comment by @maxzeroedge on how to get jQuery up and running.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.