6 Star 11 Fork 5

testnulldefined / PostbirdImgGlass

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

postbirdImageGlass

postbird-img-glass.js 图片放大镜

在线查看效果

http://postbird.oschina.io/postbirdimgglass

优点:

无缝接入,直接传入需要事件监听的DOM即可。

不足:

目前没有对链接下的图片做 preventDefault() ,因此链接会进行跳转,如果有需要可以自己加进去或者叫进行判断,存在链接 则不进行处理。

说明:

*   图片放大镜
*   Author : Postbird
*   Website: http://www.ptbird.cn
*   License: MIT

引入方式:

src="./js/postbird-img-glass.js

使用方式:

// 示例中使用的方式
PostbirdPictureMagnifyingGlass.init({
    domSelector:".img-container img",
    animation:true
});

参数说明:

init({})传入参数为对象
* domSelector  - dom选择器             默认 img  
* width        - 放大后图片宽度        默认 auto
* height       - 放大后图片高度        默认 auto
* boxClassName - 放大镜的容器的class   默认 postbird-img-glass-box
* boxBgColor   - 放大镜容器的背景色   默认  rgba(0,0,0,0.8)
* animation    - 是否开启CSS3动画     默认 false IE10+ 才有效

注意事项:

1. animation 使用css3动画,需要 IE10+
2. 最低支持 IE9 ,事件监听使用 addEventListener
3. 需要在文档加载完成后才能进行操作 
4. css样式及动画可以将css复制并格式化后,自定义。
MIT License Copyright (c) 2017 postbird Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

javascript 图片放大镜 展开 收起
JavaScript
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/postbird/PostbirdImgGlass.git
git@gitee.com:postbird/PostbirdImgGlass.git
postbird
PostbirdImgGlass
PostbirdImgGlass
master

搜索帮助