How to enlarge layui pictures

爱喝马黛茶的安东尼
Release: 2019-07-17 09:26:53
Original
3110 people have browsed it

How to enlarge layui pictures

Look at the renderings first

How to enlarge layui pictures

How to enlarge layui pictures

##Step one:

HTML code: Create slider

<div id="slideys" class="demo-slider"></div>
Copy after login

Related recommendations: "

layui framework tutorial"

Part 2: javascript code

var ysw = 0;   //记录图片原始宽度
var ysh = 0;   //记录图片原始高度
layui.use(&#39;slider&#39;, function(){     
var $ = layui.$      
,slider = layui.slider;     
slider.render({            
elem: &#39;#slideys&#39;             
,value: 0 //初始值             
,theme: &#39;#1E9FFF&#39;            
,step: 1 //步长            
,min: -10 //最小值            
,max: 10 //最大值            
,showstep: true //开启间隔点            
,change: function(value){                
if(ysw ==0 || ysh == 0){                    
return;                
}                
var pjw = ysw/20;                
var pjh = ysh/20;                
var img =  $("#dximg");  //图片ID                
if(img!=null){                    
var w = Math.round(ysw+(pjw*value));                    
var h = Math.round(ysh+(pjh*value));                    
$(img).css("width", w );                      
$(img).css("height", h );                 
}              
}          
});    
});
Copy after login

Log in to the tool network to proceed Online image size conversion.

How to enlarge layui pictures

The above is the detailed content of How to enlarge layui pictures. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template