jq //可以这么写 $.expr[':']["voice-playing"]=function(el){var$sel=$(el);varplayer=$(el).data("wxy.player"); returnplayer&&player.isPlaying&&player.isPlaying();}
zepto //自定义选择器名称不能带减号,返回值要是undifine或者dom对象,回调函数第一个参数不是dom而是dom.index $.expr[':']["voice_playing"]=function(index){//这里不能写成voice-playing var$sel=$(this);varplayer=$sel.data("wxy.player"); if(player&&player.isPlaying&&player.isPlaying()){ returnthis; }}
兼容的写法
if(window.Zepto){ $.expr[':']["voice_playing"]=function(index){ varplayer=$(this).data("wxy.player"); if(player&&player.isPlaying&&player.isPlaying()){ returnthis; } }; }elseif(window.jQuery){ $.expr[':']["voice_playing"]=function(el){ varplayer=$(el).data("wxy.player"); returnplayer&&player.isPlaying&&player.isPlaying(); }; }

更多相关文章

  1. java漏洞成黑客目标微软呼吁用户更新软件

随机推荐

  1. php中的substr_replace函数怎么用
  2. php中的array_merge函数怎么用
  3. php中的substr_count函数怎么用
  4. php中的chunk_split函数怎么用
  5. php中的strnatcasecmp函数怎么用
  6. php中的strnatcmp函数怎么用
  7. php rtrim函数怎么用
  8. php strrev怎么用
  9. php中的str_ireplace函数怎么用
  10. php wordwrap函数怎么用