This is the first time I have completely encapsulated small special effects by myself. I am a little excited to share it with you. I hope it can be helpful to children who are exploring like me.
js part:
var show_obj = function(obj,at,ob){
$(obj).bind('click', function(){
var showTxt = $(this).children(at);
//alert($(at).html());
//alert(sObj);
//alert();
//alert($(this).parent().children(p).html());
if(showTxt .html() == ' '){
showTxt.html('-')
}else{
showTxt.html(' ')
}
$(this).parent ().children(ob).slideToggle(300);
})
}
html Quote:
$(function(){
show_obj('.slide_show','.slide_show a', '.p-silde');
})
html code:
PS: Remember to quote the jQuery framework, which is compatible with ie6 and above, Firefox, Google, and ie6 has not been tested. You can test it yourself.