I found this solution that does not convince me a lot but...it
works :)
function addMessageClickHandlers(){
$('#messages h3 + div').hide();
$('#messages h3').click(function(event){
if(!$(event.target).is(":input"))
{
var $nextDiv = $(this).next();
var $visibleSiblings =
$nextDiv.siblings('div:visible:not(.all_msg_tools)');
if ($visibleSiblings.length)
$visibleSiblings.slideUp('fast', function()
{$nextDiv.slideToggle('fast');});
else
$nextDiv.slideToggle('fast');
return false;
}
});
}
On 29 oct, 16:11, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Hello,
>
> Here is the DOM structure I use :
> <h3 >
> <label>
> <input type="checkbox" name="selectedMsg[]"
> value="15" />
> </label>
> <a href="read-message-15.html" title="">Re : Title</a>
> </h3>
> <div>
> <p>my text</p>
> </div>
>
> And I would like to use a sort of accordion effect once I click the h3
> node and avoid accordion effect if the click is on the checkbox.
>
> Impossible to do and any advice is welcome.
>
> Here is the js code I used, the click on the checkbox is ok but the
> click on the h3 follows the "href" link.
>
> function addMessageClickHandlers(){
> $('#messages h3 + div').hide();
> $('#messages h3').filter(":checkbox").click(function(){
> var $nextDiv = $(this).next();
> var $visibleSiblings =
> $nextDiv.siblings('div:visible:not(.all_msg_tools)');
> if ($visibleSiblings.length)
> $visibleSiblings.slideUp('fast', function()
> {$nextDiv.slideToggle('fast');});
> else
> $nextDiv.slideToggle('fast');
> return false;
> });}
>
> $(document).ready(addMessageClickHandlers);
>
> Thanx a lot