1.插件
http://www.w3cways.com/1765.html
里面也有详细的文档和demo
2.原理
http://blog.csdn.net/wwbayyn/article/details/53373629
这个写的好详细,自己也可以实现