Return to Snippet

Revision: 29444
at July 29, 2010 23:00 by cryothic


Updated Code
HTML:
<div class="clickable">
 <h2>Item title</h2>
 <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin lacinia semper molestie...<p>
 <a href="#">Read more</a>
</div>

JS:
$(".clickable")
 .click(function(){
  location = $(this).find("a:first").attr("href");
 })
 .mouseover(function(){
  $(this).toggleClass("hover");
 })
 .mouseout(function(){
  $(this).toggleClass("hover");
 });

Revision: 29443
at July 29, 2010 18:10 by cryothic


Initial Code
//CLICKABLE Items
$(".clickable")
	.click(function(){
		location = $(this).find("a:first").attr("href");
	})
	.mouseover(function(){
		$(this).toggleClass("hover");
	})
	.mouseout(function(){
		$(this).toggleClass("hover");
	});

Initial URL

                                

Initial Description
Making a box clickable. It uses the first link from the box as a location for the click event. In this case, it also toggles a hover-class for visual puposes.

Initial Title
Clickable Items

Initial Tags

                                

Initial Language
jQuery