$('.c_showFile').on('change',function(){
				var c_showImg =this.files[0];
				getObjectURL(c_showImg);
			})

			function getObjectURL(file) {
				var url = null;
				if(window.createObjectURL != undefined) { // basic
					url = window.createObjectURL(file);
				} else if(window.URL != undefined) { // mozilla(firefox)
					url = window.URL.createObjectURL(file);
				} else if(window.webkitURL != undefined) { // webkit or chrome
					url = window.webkitURL.createObjectURL(file);
				}
				$('.file').css("background-image","url("+url+")");
				$('.file').css("background-size","100% 100%")
				return url;
			}

 

兼容性没有经过测试。需要用到的小伙伴请根据需求使用。

相关文章:

  • 2021-07-02
  • 2021-12-31
  • 2021-06-26
  • 2022-12-23
  • 2021-12-20
  • 2022-12-23
  • 2022-12-23
  • 2021-11-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-14
  • 2022-12-23
  • 2021-08-21
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案