I'm tryin' to make the article's link clickable on the whole article space.
First, I did the hover thing, changing color on mouseover and so on... then on click it should trigger the link, but this gives a "too much recursion".
I think it's a event bubbling
problem. I tried to work with event.cancelBubble = true;
or stopPropagation()
with no luck. Worse luck!
anyone?
$("div.boxContent").each(function() {
if ($(this).find(".btn").length) {
var $fade = $(this).find("div.btn a > span.hover");
var $title = $(this).find("h1, h2, h3, h4, h5");
var $span = $(this).find("span").not("span.hover");
var $text = $(this).find("p");
var titleColor = $title.css('color');
var spanColor = $span.css('color');
$(this).css({'cursor':'pointer'}).bind({
mouseenter:function() {
$text.stop().animate({color:linkHover},textAnim);
$title.stop().animate({color:linkHover},textAnim);
$span.stop().animate({color:linkHover},textAnim);
$fade.stop(true,true).fadeIn(textAnim);
}, mouseleave:function() {
$text.stop().animate({color:linkColor},textAnim);
$title.stop().animate({color:titleColor},textAnim);
$span.stop().animate({color:spanColor},textAnim);
$fade.stop(true,true).fadeOut(textAnim);
}, focusin:function() {
$text.stop().animate({color:linkHover},textAnim);
$title.stop().animate({color:linkHover},textAnim);
$span.stop().animate({color:linkHover},textAnim);
$fade.stop(true,true).fadeIn(textAnim);
}, focusout:function() {
$text.stop().animate({color:linkColor},textAnim);
$title.stop().animate({color:titleColor},textAnim);
$span.stop().animate({color:spanColor},textAnim);
$fade.stop(true,true).fadeOut(textAnim);
}
}).click(function() {
$(this).find("div.btn a").trigger('click');
});
}
});