Jquery 随笔

jQuery中 遍历

var arr = ['a','b','c'];

   $.each(arr,function(k,v){ 
      console.log(k); //键
      console.log(v); //值
      if(v == ‘a’){
       arr.splice(k,1);//删除下表为k的值
      }
   });
arr.push('e');//添加元素
 
 
function getQueryString(name) {
    var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
    var r = window.location.search.substr(1).match(reg);
    if (r != null) {
        return unescape(r[2]);
    }
    return null;
}
 
 
键盘事件 
$(function(){ $(document).keypress(function (e) {
if (e.keyCode == 13){ vens_submit(); return false; } }) });
jQuery实现动画、消失、显现、渐出、渐入效果
  
          $("img").hide(500) ; //消失 
          $("img").show(5000) ; //显现  
          $("img").slideUp(5000) ; //滑动消失  
          $("img").slideDown(5000) ; //滑动显现  
          $("img").slideToggle(5000) ; //滑动切换(消失后显现,显现后消失)  
          $("img").fadeOut(5000) ; //淡出  
          $("img").fadeIn(5000) ; //淡入  
          $("img").fadeTo(500,0.5) ; //淡化  
          $("div").animate({left:"800px"},5000) ; //移动(需要调整对象的style属性中position的值absolute) 
 
 
原文地址:https://www.cnblogs.com/vens/p/8549387.html