diff --git a/dist/imgZoom.d.ts.map b/dist/imgZoom.d.ts.map
index e1f4375..d13d138 100644
--- a/dist/imgZoom.d.ts.map
+++ b/dist/imgZoom.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"imgZoom.d.ts","sourceRoot":"","sources":["../src/imgZoom.js"],"names":[],"mappings":";;;;;IA+YU;;;;;;MAUL;;AAjZD,4BAAiB;AACjB,0BAAoB;AACpB,2BAAqB;AAgVzB,2CAOC;AAGD,4CAOC;AA5HD,wCA+BC;AAGD,+BAKC;AAqCD,0DAgBC"}
\ No newline at end of file
+{"version":3,"file":"imgZoom.d.ts","sourceRoot":"","sources":["../src/imgZoom.js"],"names":[],"mappings":";;;;;IAkZU;;;;;;MAUL;;AApZD,4BAAiB;AACjB,0BAAoB;AACpB,2BAAqB;AAmVzB,2CAOC;AAGD,4CAOC;AA5HD,wCA+BC;AAGD,+BAKC;AAqCD,0DAgBC"}
\ No newline at end of file
diff --git a/package.json b/package.json
index ed9010c..8deb9da 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "imgzoom-li",
- "version": "0.9.4",
+ "version": "0.9.5",
"description": "一个可以查看图片(可以缩放,拖拽)的JS插件",
"main": "./src/imgZoom.min.js",
"types": "./dist/imgZoom.d.ts",
diff --git a/src/imgZoom.js b/src/imgZoom.js
index a69e706..bf3db12 100644
--- a/src/imgZoom.js
+++ b/src/imgZoom.js
@@ -227,10 +227,13 @@ function bing(){
//判断class字符串是否存在imgzoom
function inStr(str, string) {
var isin = false;
- var arr = str.split(' ');
- for (var i in arr) {
- if (arr[i] == string) {
- isin = true;
+ if (typeof str === "string") {
+ var arr = str.split(' ');
+ for (var i in arr) {
+ if (arr[i] === string) {
+ isin = true;
+ break;
+ }
}
}
return isin;
@@ -411,4 +414,4 @@ var imgZoom = function(){
};
}();
-export default imgZoom
\ No newline at end of file
+export default imgZoom
diff --git a/src/imgZoom.min.js b/src/imgZoom.min.js
index cc56736..cbcc55d 100644
--- a/src/imgZoom.min.js
+++ b/src/imgZoom.min.js
@@ -22,4 +22,4 @@
- `}function lastnext(n){let e=document.getElementById("_imgzoom").getElementsByClassName(n)[0];e.addEventListener("mousemove",function(){e.getElementsByTagName("p")[0].style.display="block"}),e.addEventListener("mouseout",function(){e.getElementsByTagName("p")[0].style.display="none"}),e.addEventListener("mousedown",function(e){e.stopPropagation()}),e.addEventListener("click",()=>{let i=void 0;var t=document.getElementsByClassName("imgZoom");for(let e=0;e{e.preventDefault(),Detail(e,t)}),t.addEventListener("DOMMouseScroll",e=>{e.preventDefault(),Detail(e,t)})}function Detail(e,t){var i;(e=e||window.event).wheelDelta<0?(e=Math.round(.9*t.offsetWidth),i=Math.round(.9*t.offsetHeight),(360{e/=t;e<=window.innerWidth/window.innerHeight?(t=(window.innerHeight-350)*e,n.style.width=t+"px"):n.style.width=window.innerWidth-200+"px"};t&&(t.preventDefault?t.preventDefault():t.returnValue=!1);t=document.getElementById("net").src;let n=document.getElementById("_imgzoom");var e=_CurrentImage.src;if(_size[e])i(_size[e].width,_size[e].height);else{console.log(555);let e=new Image;e.src=t,e.complete?i(e.width,e.height):e.onload=function(){i(e.width,e.height)}}}function ThemeSwitch(e,t){t&&(t.preventDefault?t.preventDefault():t.returnValue=!1),e&&(_theme=e),Array.from(document.getElementsByClassName("_imgzoom_box")).forEach(e=>{e.style.backgroundColor="day"==_theme?"black":"white"}),Array.from(document.getElementsByClassName("_imgzoom_title")).forEach(e=>{e.style.color="day"==_theme?"white":"black"}),_theme="night"==_theme?"day":"night"}function targetImg(e){e&&(e.preventDefault?e.preventDefault():e.returnValue=!1),_CurrentImage?window.open(_CurrentImage.src):console.error('F01: Imgzoom is not initialized, please execute "imgZoom.init()"')}function SetOption(e){e.width&&(_width=e.width),e.title&&(_title=e.title),e.top&&(_top=e.top),e.left&&(_left=e.left),e.theme&&(_theme=e.theme),e.svgCache&&(_svgCache=e.svgCache)}function SetTitle(e){try{document.querySelector("p._imgzoom_title").firstChild.nodeValue=e}catch(e){console.log(e)}}function isPE(){return/Android|webOS|iPhone|ipod|ipad|BlackBerry/i.test(navigator.userAgent)}function start(){create(),bing(),document.addEventListener("click",e=>{var t=e.target;"IMG"==t.nodeName&&inStr(t.className,"imgZoom")&&Open(t),(inStr(t.className,"imgzoom_shadow")||inStr(t.className,"imgzoom_close"))&&Close(),inStr(t.className,"imgzoom_resize")&&Resize(e),inStr(t.className,"imgzoom_check")&&ThemeSwitch(null,e),inStr(t.className,"imgzoom_imglink")&&targetImg(e)})}var imgZoom={Version:Version,Title:Title,Author:Author,init:function(){return imgLoad(),start(),{SetOption:SetOption,SetTitle:SetTitle,Open:Open,Close:Close,ThemeSwitch:ThemeSwitch}}};export default imgZoom;
\ No newline at end of file
+ `}function lastnext(n){let e=document.getElementById("_imgzoom").getElementsByClassName(n)[0];e.addEventListener("mousemove",function(){e.getElementsByTagName("p")[0].style.display="block"}),e.addEventListener("mouseout",function(){e.getElementsByTagName("p")[0].style.display="none"}),e.addEventListener("mousedown",function(e){e.stopPropagation()}),e.addEventListener("click",()=>{let i=void 0;var t=document.getElementsByClassName("imgZoom");for(let e=0;e{e.preventDefault(),Detail(e,t)}),t.addEventListener("DOMMouseScroll",e=>{e.preventDefault(),Detail(e,t)})}function Detail(e,t){var i;(e=e||window.event).wheelDelta<0?(e=Math.round(.9*t.offsetWidth),i=Math.round(.9*t.offsetHeight),(360{e/=t;e<=window.innerWidth/window.innerHeight?(t=(window.innerHeight-350)*e,n.style.width=t+"px"):n.style.width=window.innerWidth-200+"px"};t&&(t.preventDefault?t.preventDefault():t.returnValue=!1);t=document.getElementById("net").src;let n=document.getElementById("_imgzoom");var e=_CurrentImage.src;if(_size[e])i(_size[e].width,_size[e].height);else{console.log(555);let e=new Image;e.src=t,e.complete?i(e.width,e.height):e.onload=function(){i(e.width,e.height)}}}function ThemeSwitch(e,t){t&&(t.preventDefault?t.preventDefault():t.returnValue=!1),e&&(_theme=e),Array.from(document.getElementsByClassName("_imgzoom_box")).forEach(e=>{e.style.backgroundColor="day"==_theme?"black":"white"}),Array.from(document.getElementsByClassName("_imgzoom_title")).forEach(e=>{e.style.color="day"==_theme?"white":"black"}),_theme="night"==_theme?"day":"night"}function targetImg(e){e&&(e.preventDefault?e.preventDefault():e.returnValue=!1),_CurrentImage?window.open(_CurrentImage.src):console.error('F01: Imgzoom is not initialized, please execute "imgZoom.init()"')}function SetOption(e){e.width&&(_width=e.width),e.title&&(_title=e.title),e.top&&(_top=e.top),e.left&&(_left=e.left),e.theme&&(_theme=e.theme),e.svgCache&&(_svgCache=e.svgCache)}function SetTitle(e){try{document.querySelector("p._imgzoom_title").firstChild.nodeValue=e}catch(e){console.log(e)}}function isPE(){return/Android|webOS|iPhone|ipod|ipad|BlackBerry/i.test(navigator.userAgent)}function start(){create(),bing(),document.addEventListener("click",e=>{var t=e.target;"IMG"==t.nodeName&&inStr(t.className,"imgZoom")&&Open(t),(inStr(t.className,"imgzoom_shadow")||inStr(t.className,"imgzoom_close"))&&Close(),inStr(t.className,"imgzoom_resize")&&Resize(e),inStr(t.className,"imgzoom_check")&&ThemeSwitch(null,e),inStr(t.className,"imgzoom_imglink")&&targetImg(e)})}var imgZoom={Version:Version,Title:Title,Author:Author,init:function(){return imgLoad(),start(),{SetOption:SetOption,SetTitle:SetTitle,Open:Open,Close:Close,ThemeSwitch:ThemeSwitch}}};export default imgZoom;
\ No newline at end of file