jquery - some identical classes, act in each -
i have section see 1 or more messages user must agree, should leave one, if accepted , there more shows following can not act on each of these classes separately
then have container several equal classes
html:
<div class="container"> <p class="active"><span>1lorem ipsum dolor sit amet, consectetur adipiscing elit. praesent sagittis justo sit amet odio posuere fringilla. sed et nunc ligula. cras faucibus porttitor ipsum.</span> <a title="ver más mensajes" href="javascript:void(0)">siguiente mensaje</a> <div class="clear"></div> </p> <p><span>1 praesent sagittis justo sit amet odio posuere fringilla. sed et nunc ligula. cras faucibus porttitor ipsum, non accumsan sem varius mollis.</span><a title="ver mensaje anterior" href="javascript:void(0)">mensaje anterior</a> <div class="clear"></div> </p> </div> <div class="container"> <p class="active"><span>1lorem ipsum dolor sit amet, consectetur adipiscing elit. praesent sagittis justo sit amet odio posuere fringilla. sed et nunc ligula. cras faucibus porttitor ipsum.</span> <a title="ver más mensajes" href="javascript:void(0)">siguiente mensaje</a> <div class="clear"></div> </p> <p><span>1 praesent sagittis justo sit amet odio posuere fringilla. sed et nunc ligula. cras faucibus porttitor ipsum, non accumsan sem varius mollis.</span><a title="ver mensaje anterior" href="javascript:void(0)">mensaje anterior</a> <div class="clear"></div> </p> </div> etc...
css:
.pieza .container p{display:none;overflow:hidden} .pieza .container p.active{display:block}
and:
$(".container p.active").fadein("slow"); $(".container p > a").live('click', function(e) { e.preventdefault(); $('.container p').toggle('fast'); $(this).parent().fadeout('fast', function() { $(this).closest('.container p').remove(); }); });
but acts on classes how can act alone in each zone?
thanks in advance
maybe remove
$('.container p').toggle('fast');
or write
$('.container p', this).toggle('fast');
Comments
Post a Comment