刚开始接触jquery,感觉一切都很新鲜,奇妙的动画深深的吸引住了我。今天刚学习了animate函数的用法,浅谈一下学后感!
从一组元素效果开始写起,animate()函数中可以有四个参数,鉴于个人应用得比较多的是前两个元素,所以就只讲这两个参数!第一个参数:一组包含作为动画属性和终值的样式属性和及其值的集合(具体参数参考手册);第二个参数就是动画执行速度啦(可以直接用微妙数,也可用fast/slow/normal);如果一组元素同时写进animate的第一个参数中,那么这几个动作就是同时进行的;当然如果其他的函数写在animate之后或者之前,同样的这写函数执行的动作也是同时进行的;如果想要动作先后按顺序执行,则可以用后缀方法,即$('#ID').animate(1).animate(2).animate(3);animate之间是没有逗号的,这样动作的执行顺序就会从1到3了。
多组元素的效果呢,同样默认情况下也是同时执行的;如果想要把类似了css()之类的不能在animate中执行的动作在animate执行之后执行,就要在animate函数中使用回调函数了,规则是.animate(para,speed,function(){});这样在animate中的回调函数就会在animate函数执行后开始执行
<script src="jquery-1.4.4.min.js"></script>
<script>
$(document).ready(
function(){
$('#add').click(function(){
if ($("#vote_img").height() <= 95) {
$("#vote_img").animate({ height: "+=3px" });
} else {
$("#vote_img").animate({ height: "98px" });
}
}),
$("#plus").click(function() {
if ($("#vote_img").height() >= 3) {
$("#vote_img").animate({ height: "-=3px" });
} else {
$("#vote_img").animate({ height: "0px" });
}
});
}
)
</script>
<div style="background:url(vote_bg.gif) repeat-y; height:100px; width:20px;"><img style="display:inline; height:5px; width:18px;" id="vote_img" src="vote_1.gif" /></div>
<input type="button" value="add" id="add"/><br />
<input type="button" value="plus" id="plus" />
php编码转换可用string
iconv ( string in_charset, string out_charset, string
str );函数
将in_charset编码转变为out_charset编码;一般在采集某些网站数据的时候,经常出现编码转换的
问题,其次,在遇到编码转换之后出现的全角空格的问题,需要用到正则表达式的替换功能
可用$str1=preg_replace('/( )+/','',$str1);进行替换,注意()之间为全角空格
安家啦,刚开的博客。以后这里就是我学习php的落笔处啦。现在还算是只刚要开始起飞的菜鸟!以后多多努力,多多进步!