Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/05/2010, 21:49
Shadbox
 
Fecha de Ingreso: mayo-2010
Mensajes: 3
Antigüedad: 14 años
Puntos: 0
ayuda con jquery

Hola como andan? Estoy trabajando con Jomsocial y en un sector de mi sitio hay unos links para filtrar informacion (mostrar posteos mios o de mis amigos), pero dentro de ese bloque yo tengo los comentarios de los posteos colapsados en forma de acordeón. El problema es que cuando los usuarios clickean en esos links de filtro el sistema de acordeón se rompe y aparecen todos los comentarios desplegados sin el link "Ver todos / Ocultar todos"

Aca esta el codigo que arma el acordeón:

<script type="text/javascript" src="/components/com_community/assets/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
<!--
// this tells jquery to run the function below once the DOM is read
$(document).ready(function() {

// choose text for the show/hide link
var showText="Ver Todos";
var hideText="Ocultar Todos";

// append show/hide links to the element directly preceding the element with a class of "toggle"
$(".toggle").prev().append(' (<a href="#" class="toggleLink">'+showText+'</a>)');

// hide all of the elements with a class of 'toggle'
$('.toggle').hide();

// capture clicks on the toggle links
$('a.toggleLink').click(function() {

// change the link depending on whether the element is shown or hidden
if ($(this).html()==showText) {
$(this).html(hideText);
}
else {
$(this).html(showText);
}

// toggle the display
$(this).parent().next('.toggle').toggle('slow');

// return false so any link destination is not followed
return false;

});
});

//-->
</script>

Yo lo unico que hago es envolver el foreach que trae los comentarios con <div class="toggle">

Aca esta el codigo de los links que filtran:

<div id="activity-stream-nav" class="filterlink">
<div style="float: right;">
<a class="active-profile-and-friends-activity active-state" href="javascript:void(0);"><?php echo JText::sprintf('CC PROFILE OWNER AND FRIENDS' , $profileOwnerName );?></a>
<a class="active-profile-activity" href="javascript:void(0);"><?php echo $profileOwnerName ?></a>
</div>
<div class="loading"></div>
</div>

Y aca está el Jquery que lo activa:

jQuery('.active-profile-and-friends-activity').bind('click', function() {
if ( !jQuery(this).hasClass('active-state') ) {
loading( jQuery(this).attr('class') );
jax.call('community', 'frontpage,ajaxGetActivities', 'active-profile-and-friends');
}
});
jQuery('.active-profile-activity').bind('click', function() {
if ( !jQuery(this).hasClass('active-state') ) {
loading( jQuery(this).attr('class') );
jax.call('community', 'frontpage,ajaxGetActivities', 'active-profile');
}
});


No soy programador, pero imagino que el problema es el domready no?
Hay una forma de resolver esto? Espero que me ayuden
Muchas gracias!