同时设置 border-radius
& background
& border-color
& background-clip
在 Android 4.1.1
上有 bug
设置 border
不是透明色,表现的和预期一样:
如果设置为透明色,就会这样:
Refer
End.
coding my code,uku my ukulele
同时设置 border-radius
& background
& border-color
& background-clip
在 Android 4.1.1
上有 bug
设置 border
不是透明色,表现的和预期一样:
如果设置为透明色,就会这样:
End.
给 iscroll
的子元素绑定 click
事件,在 猎豹,chrome
, UC
等失效
后来查阅 文档 发现已经提示我们了
more >>
options.click
为了重写原生滚动条,iScroll
禁止了一些默认的浏览器行为,比如鼠标的点击。如果你想你的应用程序响应click
事件,那么该设置次属性为true
。请注意,建议使用自定义的tap
事件来代替它(见下面)。
默认属性:false
options.tap
设置此属性为true
,当滚动区域被点击或者触摸但并没有滚动时,可以让iScroll
抛出一个自定义的tap事件。
这是处理与可以点击元素之间的用户交互的建议方式。侦听tap
事件和侦听标准事件的方式一致。示例如下:
12 element.addEventListener('tap', doSomething, false); \\ Native$('#element').on('tap', doSomething); \\ jQuery你可以通过传递一个字符串来自定义事件名称。比如:
tap: ‘myCustomTapEvent’
在这个示例里你应该侦听名为myCustomTapEvent的事件。
默认值:false
选择符决定它和文档树中的哪个元素相匹配,其实是模式匹配,这样它所定义的样式就能应用到那个元素上。
选择符可以简单到只有一个元素名,如 p {}
,也可以复杂到很多选择符组合在一起,如 .header .title {}
。那它是怎么定义的呢?CSS3 中定义:
*
)、类型选择符(p, div...
)、类(.header...
)、伪类(:first-child...
)、ID(#footer
…)、属性选择符([attr]...
)space, +, > , ~
通常我们常用的手势事件有 touchstart, touchmove, touchend
,对 touchcancel
用之甚少,仅知道就是由于系统原因导致的手势中断而触发的事件。
在一个项目中我就用到了这个事件 touchcancel
,有这么个需求:需要监听长按下载这个动作(浏览器默认支持长按下载,同时会弹出一个系统弹框)
很自然我们就想到了监听 touchstart/touchend
,在 touchstart
记录起始点/时间,在 touchend
记录终止点/时间,满足长按要求则触发事件;
给一个元素绑定 touchstart, touchmove, touchend, click
如果只是触摸一下这个元素,按理是只触发 touchstart touchend click
,如果滚动的话,应该就是多了一个 touchmove
而已
但是安卓机的某些浏览器(如 UC
)在滚动的时候不会触发 touchend
(偶尔也会触发),touchmove
可能也只是触发一次,见 demo
解决方法:
touchstart
设置 e.preventDefault()
,页面不能滚动,链接不能跳转,不会触发 click
事件touchmove
设置 e.preventDefault()
,页面不能滚动以及不能 pinch-room
Since calling preventDefault() on a touchstart or the first touchmove event of a series prevents the corresponding mouse events from firing, it’s common to call preventDefault() ontouchmove rather than touchstart. That way, mouse events can still fire and things like links will continue to work.
参考 Preventing the touch default
The default of all actions is prevented when you return false (or call preventDefault()) ontouchstart. The touchmove event is trickier: only scroll and pinch-zoom are prevented when you return false on that event.
End.
写了个简单的 rss reader 扩展,用来订阅一些博客了解最新的技术进展。
localStorage
rss feed
,都会先判断本地存储是否存在且是否过期,过期会重新更新OPML
不会立刻请求所有文章更新,而添加单个 feed
会立刻请求文章存储在本地
缺失模块。
1、在博客根目录(注意不是yilia根目录)执行以下命令:
npm i hexo-generator-json-content --save
2、在根目录_config.yml里添加配置:
jsonContent: meta: false pages: false posts: title: true date: true path: true text: true raw: false content: false slug: false updated: false comments: false link: false permalink: false excerpt: false categories: false tags: true