JS继承示例
来源:互联网 发布:java的jdk和jre 编辑:程序博客网 时间:2024/06/02 04:33
image-file-visible-init.js内容如下:
$(document).ready(function(){$.imageFileVisible({wrapSelector: ".upload-image-show1", fileSelector: ".upload-image-file2 .file",width: "100%",height: "100%"});});
image-file-visible.js内容如下:
(function($) { $.imageFileVisible = function(options) { var defaults = { wrapSelector: null, //<input type="file"> fileSelector: null , width : '100%', height: 'auto', errorMessage: "错误" }; // Extend our default options with those provided. var opts = $.extend(defaults, options); $(opts.fileSelector).on("change",function(){var file = this.files[0];var imageType = /image.*/;if (file.type.match(imageType)) {var reader = new FileReader();reader.onload = function(){var img = new Image();img.src = reader.result;$(img).width( opts.width);$(img).height( opts.height);$( opts.wrapSelector ).empty(); $( opts.wrapSelector ).append(img); /* $( opts.wrapSelector ).html(img);*/};reader.readAsDataURL(file);}else{alert(opts.errorMessage);}});}; })(jQuery);
参考链接:http://www.cnblogs.com/liqforstudy/articles/5291077.html
阅读全文
0 0
- JS继承示例
- js 继承并重写方法示例
- JS通过prototype实现继承的简单示例:
- JS继承--组合继承
- JS继承-类继承
- Js继承。
- js继承
- js继承
- js 继承
- js继承
- JS 继承
- JS 继承
- js继承
- js继承
- JS继承
- JS继承
- js继承
- JS继承
- CS 300 Least Even Digits 二分+数位DP
- Windows Server2012搭建Git服务器
- jdbc图书购买小栗子
- Error: Q0466E: An output file can only be specified if there is a single input file
- python学习-Day7-python帮助查看及数据类型转换
- JS继承示例
- IRP操作文件
- VLOOKUP 使用方法
- maven工程下pom文件详解
- android面试-Handler机制(oppo面试)
- 企业实战之Spring项目《hibernate validator+Assert参数校验》
- 现代组合理论MPT(Modern Portfolio Theory)
- 异常捕获
- 求个位、十位、百位上的数字