《去除A标签》
$txt = \ echo preg_replace(\
//data:$(\ $.ajax({
type:\
data:{id:id},
url:\
dataType : \
success:function(data){
if(data.able=='no'){
alert('当前用户组无权限');
return false;
}else if(data.msg=='success'){
alert(\审核成功!\
window.location.href=\
$this->config->item('base_url')?>?c=merchant&m=merchantList\ }
}
});
$(\全选
//新生成元素的点击事件
$(document).on('click',\ console.log('123'); })
//滚动加载更多
var totalheight = 0;
$(window).scroll( function() {
totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop());
if ($(document).height() <= totalheight) { // 说明滚动条已达底部
loadDataList(); } });
JQ 中each 不能使用break结束循环 只能用 return false;(break) return ture;(continue)
判断多选框是否一个都没选中
function register_checkform(){ var domainchecked=false;
$(\
var check=$(this).prop(\ if(check){
domainchecked=true; return false; } })
if(!domainchecked) {
alert('请选择要注册的域名'); return false; }
return true; }
按钮倒计时
var timer=null,count=10,flag=true; if(flag){
flag=false;
$(\btn-primary disabled\
var _this=$(\ timer=setInterval(function(){ count=count-1;
$(_this).html(\剩下(\秒\
if(count==-1){
clearInterval(timer);
$(_this).html(\重新获取\
$(\btn btn-block btn-primary btn-sm\
flag=true; count=60; } },1000);
$.ajax({
type:\
data:{sendType:sendType,IDContact:=$contact->IDContact?>},
url:\dittemplate-ajax\
async:false,
success:function(data){
} }); }
jQuery判断当前元素是第几个元素
如果我们点击任何一个li标签,想知道当前点击的是第几个li标签,可以使用下面的代码: 1 2 3 4 $(\).click(function () { var index = $(\).index(this); alert(index); }); 如上面的jQuery代码,如果点击的第一个会提示”0″,如果是第二个li标签会提示”1″,注意索引序列号是从0开始的。
jQuery 获取第N个元素
同理,如果我们要获取第二li标签元素,可以使用下面的代码 1 var element=$(\li\).eq(1);alert($(element).html());
图片预加载
1.隔一秒加载一张
window.current_number = 1;
window.lazy_load_img = window.setInterval(function(){ var img_list = $(\ if( img_list.length == window.current_number){ window.clearInterval(window.lazy_load_img); return false; }
var url
= img_list.eq(window.current_number).attr('picv'); var img = new Image(); img.src = url;
if( img.complete ){
window.current_number ++; }else{
img.onload = function(){}; window.current_number++; } },2000);
2.实用loading ',url);
var img = new Image();
var url = items.eq(index).attr('picv'); img.src = url;
if( img.complete ){
$(\
}else{
$(\','/themes/wap/default/img/loading.jpg');
img.onload = function(){
$(\r('src',url);
}; }
手机顺畅滚动样式
#tc_box{ overflow:auto;
-webkit-overflow-scrolling:touch;-moz-overflow-scrolling:touch;-o-overflow-scrolling:touch;}
向上向下渐隐动画CSS
.arrow{width:50px;height:28px;background:url(../img/down.png) 0 0 no-repeat;
display: none;left:50%;margin-left:-25px;bottom: 166px;position:
fixed !important;z-index:2;-webkit-animation-name:pulldown;-webkit-animation-duration:1.5s;-webkit-animation-iteration-count:infinite;animation-name:pulldown;animation-duration:1.5s;animation-iteration-count:infinite}
@-webkit-keyframes
pullup{0%,30%{opacity:0;-webkit-transform:translate(0,10px)}60%{opacity:1;-webkit-transform:translate(0,0)}100%{opacity:0;-webkit-transform:translate(0,-8px)}} @-moz-keyframes
pullup{0%,30%{opacity:0;-moz-transform:translate(0,10px)}60%{opacity:1;-moz-transform:translate(0,0)}100%{opacity:0;-moz-transform:translate(0,-8px)}} @keyframes
pullup{0%,30%{opacity:0;transform:translate(0,10px)}60%{opacity:1;transform:translate(0,0)}100%{opacity:0;transform:translate(0,-8px)}}
@-webkit-keyframes
pulldown{100%,60%{opacity:0;-webkit-transform:translate(0,10px)}30%{opacity:1;-webkit-transform:translate(0,0)}0%{opacity:0;-webkit-transform:translate(0,-8px)}} @-moz-keyframes
pulldown{100%,60%{opacity:0;-moz-transform:translate(0,10px)}30%{opac