基于Jquery实现苹果开关按钮特效的插件
默认使用
$.switch()
调整大小
$.switch({
target:'.biggerSwitch',
height:200
})
$.switch({
target:'.smallerSwitch',
height:50
})
开关事件的回调
$.switch({
target:'.callbackSwitch',
callback:function(that){
//return false 返回原始状态
if(that.attr('class').indexOf('on')){
//开启
}else{
//关闭
}
}
})
动画速度调整
$.switch({
target:'.speedSwitch',
speed:'slow',//'slow',
height:500
})
github地址:https://github.com/yetianyue/Jquery-switch
目前唯一的缺陷背景色,滑动状态还未结束就已经改变过来,待解决。有什么好的办法在评论中留言指正。
解决上述问题: