Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在Switchery插件中向jackColor添加框阴影_Javascript_Css_Jquery Plugins - Fatal编程技术网

Javascript 如何在Switchery插件中向jackColor添加框阴影

Javascript 如何在Switchery插件中向jackColor添加框阴影,javascript,css,jquery-plugins,Javascript,Css,Jquery Plugins,我的复选框有一个iOS7样式的开关。但是我需要用一个方框阴影显示处理程序。 如何添加框阴影时,它检查,我的代码如下 var elems=Array.prototype.slice.call(document.querySelectorAll('.js开关'); elems.forEach(函数(html){ var switchery=newswitchery(html,{color:'#fff',jackColor:'#00aeef',jackSecondaryColor:'}); html.

我的复选框有一个
iOS7
样式的开关。但是我需要用一个方框阴影显示处理程序。 如何添加框阴影时,它检查,我的代码如下

var elems=Array.prototype.slice.call(document.querySelectorAll('.js开关');
elems.forEach(函数(html){
var switchery=newswitchery(html,{color:'#fff',jackColor:'#00aeef',jackSecondaryColor:'});
html.onchange=函数(){
var medicineId=html.name;
var checked=html.checked;
var form=$('form')。get(0);
$.ajax({
标题:{
'X-CSRF-TOKEN':$('meta[name=“CSRF-TOKEN”]).attr('content'))
},
url:“{\App\Helpers\serverName()}}/change medicine-alarm?medicineId=“+medicineId+”&alarm=“+checked,”,
类型:“post”,
数据:新表单数据(表单),
数据类型:“json”,
contentType:false,
cache:false,
processData:false
}).完成(功能(res){
var信息=res;
控制台日志(信息);
});

我搜索了很多,最后决定阅读Javascript主文件

我将
,boxShadow:null
添加到default的数组中,然后 我将
this.jack.style.boxShadow=(this.options.boxShadow!==this.options.boxShadow)?this.options.boxShadow:'-6px 0px 9px 1px#dcdc'
添加到Switchery.prototype.setPosition中 然后我将
this.jack.style.boxShadow=this.options.boxShadow;
添加到Switchery.prototype.colorize函数中。最后调用我的脚本。您可以在代码段中找到我的描述

var默认值={
颜色:“#64bd63”
,第二种颜色:“#dfdfdf”
,jackColor:“#fff”
,jackSecondaryColor:null
,类名:'switchery'
,已禁用:false
,禁用容量:0.5
,速度:'0.4s'
,大小:'默认'
,boxShadow:null
};
Switchery.prototype.setPosition=函数(单击){
var checked=this.isChecked()
,switcher=this.switcher
,jack=this.jack;
如果(单击并选中)选中=false;
else if(单击并选中)checked=true;
如果(选中===true){
this.element.checked=true;
if(window.getComputedStyle)jack.style.left=parseInt(window.getComputedStyle(switcher.width)-parseInt(window.getComputedStyle(jack.width)+'px';
else jack.style.left=parseInt(switcher.currentStyle['width'])-parseInt(jack.currentStyle['width'])+'px';
如果(this.options.color)this.colorize();
这个.setSpeed();
}否则{
jack.style.left=0;
this.element.checked=false;
this.switcher.style.boxShadow='inset 0'+this.options.secondaryColor;
this.switcher.style.borderColor=this.options.secondaryColor;
this.switcher.style.backgroundColor=(this.options.secondaryColor!==默认值.secondaryColor)?this.options.secondaryColor:“#fff”;
this.jack.style.backgroundColor=(this.options.jackSecondary颜色!==this.options.jackColor)?this.options.jackSecondary颜色:this.options.jackColor;
this.jack.style.boxShadow=(this.options.boxShadow!==this.options.boxShadow)?this.options.boxShadow:“-6px 0px 9px 1px#dcdc”;
这个.setSpeed();
}
};
Switchery.prototype.colorize=函数(){
var switcherHeight=this.switcher.offsetHeight/2;
this.switcher.style.backgroundColor=this.options.color;
this.switcher.style.borderColor=this.options.color;
this.switcher.style.boxShadow='inset 0'+switcherHeight+'px'+this.options.color;
this.jack.style.backgroundColor=this.options.jackColor;
this.jack.style.boxShadow=this.options.boxShadow;
};
//无论你想在哪里调用插件,你都需要像下面那样调用
var switchery=new switchery(html,{color:'#fff',jackColor:'#00aeef',boxShadow:'-6px 0px 9px 1px#dcdc'});