$(document).ready(function(){
$('.views-field-nothing').click(function(){
$(this).parent().find('.comments-toggle').slideToggle("fast");
$('.comments-toggle:contains('Anonimo')').css("display", "none");
});
});
at first it must show the comment field clicking on View-field-nothing (slideToggle) then if it find “Anonimo” it should replace the slideToggle -> Display:block; with a Display:none..
<div class="views-row">
<div class="views-field-nothing">
<span class="field-content">
<span class="comments">COMMENTI</span>
</span>
</div>
<div class="views-field-name">
<span class="field-content">
<span class="comments-toggle">Anonimo</span>
</span>
</div>
</div>
<div class="views-row">
<div class="views-field-nothing">
<span class="field-content">
<span class="comments">COMMENTI</span>
</span>
</div>
<div class="views-field-name">
<span class="field-content">
<span class="comments-toggle">Utente A</span>
</span>
</div>
</div>
once you click the second “Commenti” that is is in the “view-field-nothing” div the function .slideToggle() must write a display:block; in the html, like down here
<div class="views-row">
<div class="views-field-nothing">
<span class="field-content">
<span class="comments">COMMENTI</span>
</span>
</div>
<div class="views-field-name">
<span class="field-content">
<span class="comments-toggle">Anonimo</span>
</span>
</div>
</div>
<div class="views-row">
<div class="views-field-nothing">
<span class="field-content">
<span class="comments">COMMENTI</span>
</span>
</div>
<div class="views-field-name">
<span class="field-content">
<span class="comments-toggle" display:block;>Utente A</span>
</span>
</div>
</div>
if i click the first “COMMENTI” it should find the “Anonimo” string in the span and write at the end of the span a display:none;
<div class="views-row">
<div class="views-field-nothing">
<span class="field-content">
<span class="comments">COMMENTI</span>
</span>
</div>
<div class="views-field-name">
<span class="field-content">
<span class="comments-toggle" style="display:none;">Anonimo</span>
</span>
</div>
</div>
<div class="views-row">
<div class="views-field-nothing">
<span class="field-content">
<span class="comments">COMMENTI</span>
</span>
</div>
<div class="views-field-name">
<span class="field-content">
<span class="comments-toggle" style="display:block;">Utente A</span>
</span>
</div>
</div>
EDIT: Here’s an updated script based on your updated question. It is possible to hide all the
Anonimospans initially and then check for using the slide animations on those that don’t contain theAnonimo:Here’s the modified jsFiddle: http://jsfiddle.net/3mbMA/6/