一个不错的js颜色选择器
https://github.com/claviska/jquery-minicolors
演示: http://www.jq22.com/jquery-info204
更多js拾色器:http://www.jq22.com/jquery-plugins%E6%8B%BE%E8%89%B2%E5%99%A8-1-jq
如果同步设置input背景色,可能会出现input内text颜色与背景色难以区分的情况,可以使用如下方法自动设置文字颜色:(hex为获取到的颜色,如:#ffcc00)
var r = parseInt(hex.substr(1, 2), 16); var g = parseInt(hex.substr(3, 2), 16); var b = parseInt(hex.substr(5, 2), 16); var yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000; $(this).css({'background-color':hex, 'color': (yiq >= 128) ? 'black' : 'white'});
配置:
$('.js-color-input').each( function() { $(this).minicolors({ control: $(this).attr('data-control') || 'hue', defaultValue: $(this).attr('data-defaultValue') || '#ff0000', format: $(this).attr('data-format') || 'hex', keywords: $(this).attr('data-keywords') || '', inline: $(this).attr('data-inline') === 'true', letterCase: $(this).attr('data-letterCase') || 'lowercase', opacity: $(this).attr('data-opacity'), position: $(this).attr('data-position') || 'bottom', swatches: $(this).attr('data-swatches') ? $(this).attr('data-swatches').split('|') : [], change: function(hex, opacity){ if(! hex)return; var r = parseInt(hex.substr(1, 2), 16); var g = parseInt(hex.substr(3, 2), 16); var b = parseInt(hex.substr(5, 2), 16); var yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000; $(this).css({'background-color':hex, 'color': (yiq >= 128) ? 'black' : 'white'}); }, theme: 'default', }); });
无法安装 Java 配置文件 在行1中格式错误
无法安装 Java
配置文件 C:\ProgramData\Oracle\Java\java.settings.cfg 在行 1 中格式错误。
请检查文件的数据和格式设置。
解决方法:
首先显示隐藏文件夹,因为 C:\ProgramData是一个隐藏文件。
然后删掉 C:\ProgramData下的Oracle文件夹。
重新安装即可。
https://blog.csdn.net/u010536615/article/details/70238908
CSS3 伪类选择器 nth-child() 的用法
转自:https://www.yangqq.com/jstt/css3/2013-07-15/379.html
CSS3 伪类选择器 nth-child() 的用法
伪类选择器 nth-child() 在IE6-8和FF3.0-浏览器不支持,CSS3中nth-of-type(n)(比如nth-of-type(1))这个特殊的类选择符可以样式更加个性的标题和段落等,不过,目前nth-of-type(n)只支持火狐3、opera、safari和chrome等部分浏览器。
:nth-child()选择某个元素的一个或多个特定的子元素;你可以按这种方式进行选择:
:nth-child(length);/*参数是具体数字 length为整数*/
:nth-child(n);/*参数是n,n从0开始计算*/
:nth-child(n*length)/*n的倍数选择,n从0开始算*/
:nth-child(n+length);/*选择大于length后面的元素*/
:nth-child(-n+length)/*选择小于length前面的元素*/
:nth-child(n*length+1);/*表示隔几选一*/
例子:
li:nth-child(3){background:orange;}/*把第3个li的背景设为橙色*/
li:nth-child(3n){background:orange;}/*把第3、第6、第9、…、所有3的倍数的li的背景设为橙色*/
li:nth-child(n+3){background:orange;}/*选择从第3个元素后面的li背景设为橙色*/
li:nth-child(-n+3){background:orange;}/*选择从第3个元素前面的li把背景设为橙色*/
li:nth-child(3n+1){background:orange;}/*这种方法是实现隔几选一的效果*/
:fist-child选择某个元素的第一个子元素
例子:
li:first-child {background: green;}/*把第1个li的背景设为绿色*/
:last-child选择某个元素的最后一个子元素
例子:
li:last-child {background: green;}/*把最后一个li的背景设为绿色*/
:nth-last-child()选择某个元素的一个或多个特定的子元素,从这个元素的最后一个子元素开始算
:nth-last-child()选择器和前面的:nth-child()很相似,只是这里多了一个last,所以他起的作用就和前面的":nth-child"不一样了,他只要是从最后一个元素开始算,来选择特定元素。
例子:
li:nth-last-child(4) {background: red;}/*把倒数第4个li的背景设为红色*/
:nth-of-type()选择指定的元素
:nth-of-type类似于:nth-child,不同的是他只计算选择器中指定的那个元素,其实我们前面的实例都是指定了具体的元素,这个选择器主要对用来定位元素中包含了好多不同类型的元素是很有用处。比如说,我们div.demo下有好多p元素,li元素,img元素等,但我只需要选择p元素,并让他每隔一个p元素就有不同的样式,那我们就可以简单的写成:
p:nth-of-type(even) {background-color: lime;}
除了可以将n设置为odd(偶数)或even(奇数)外,还可以将n设置为表达式,比如,nth-of-type(3n+2)
:nth-last-of-type()选择指定的元素,从元素的最后一个开始计算
这个选择器不用说大家都能想得到了,他和前面的:nth-last-child一样使用,只是他指一了元素的类型而以。
同样在IE6-8和FF3.0-浏览器不支持这种选择器
:first-of-type选择一个上级元素下的第一个同类子元素;
:last-of-type选择一个上级元素的最后一个同类子元素;
:nth-of-type,:nth-last-of-type;:first-of-type和:last-of-type实际意义并不是很大,我们前面讲的:nth-child之类选择器就能达到这此功能,不过大家要是感兴趣还是可以了解一下,个人认为实用价值并不是很大。此类说法仅供参考。
:only-child表示的是一个元素是它的父元素的唯一一个子元素
<ul>
<li>1</li>
<li>2</li>
</ul>
<ul>
<li>3</li>
</ul>
如果我需要在ul只有一个p元素的时候,改变这个li的样式,那么我们现在就可以使用:only-child,如:
ul li {padding-left:10px;}
ul li:only-child {padding-left:15px}
:only-of-type选择一个元素是它的上级元素的唯一一个相同类型的子元素
是表示一个元素他有很多个子元素,而其中只有一个子元素是唯一的,那么我们使用这种选择方法就可以选择中这个唯一的子元素,比如说
<section>
<h2>伪类选择器的用法</h2>
<p>CSS3 伪类选择器only-of-type的用法</p>
<p>CSS3 伪类选择器only-of-type的用法</p>
</section>
如果我们想只选择中上面中的h2元素,我们就可以这样写,
h2:only-of-type{color:red;}
:empty选择的元素里面没有任何内容
:empty是用来选择没有任何内容的元素,这里没有内容指的是一点内容都没有,哪怕是一个空格,比如说,你有三个段落,其中一个段落什么都没有,完全是空的,你想这个p不显示,那你就可这样来写:
p:empty {display: none;}
wow.js与fullpage.js结合使用时失效的解决办法
第一屏可以正常显示,从第二屏开始,使用wow效果的元素就不显示了 visibility:hidden;
原因:fullpage.js 配置中使用了 scrollBar:false,隐藏了滚动条,wow无法判断滚动条位置。
解决办法:fullpage.js配置中显示滚动条 scrollBar:true,然后使用css中隐藏滚动条 body{overflow:hidden !important;}。不能直接在<body>标签上设置style,会被fullpage.js重置overflow值。
如果还不行就在fullpage运行后执行wow,设置方法: $('#fullpage').fullpage({afterRender: function(){new WOW().init();}});。我程序中这两个的执行顺序并没有影响,看别人这么说的,记录下。
CSS3实现三角形
<div class="arrow-down"><!--向下的三角--></div>
<div class="arrow-left"><!--向左的三角--></div>
<div class="arrow-right"><!--向右的三角--></div>
/*箭头向上*/
.arrow-up {
width:0;
height:0;
border-left:30px solid transparent;
border-right:30px solid transparent;
border-bottom:30px solid #fff;
}
/*箭头向下*/
.arrow-down {
width:0;
height:0;
border-left:20px solid transparent;
border-right:20px solid transparent;
border-top:20px solid #0066cc;
}
/*箭头向左*/
.arrow-left {
width:0;
height:0;
border-top:30px solid transparent;
border-bottom:30px solid transparent;
border-right:30px solid yellow;
}
/*箭头向右*/
.arrow-right {
width:0;
height:0;
border-top:50px solid transparent;
border-bottom: 50px solid transparent;
border-left: 50px solid green;
}
再配合 transform:rotate(xdeg) 就可以实现各方向的三角形了。
来源:https://www.cnblogs.com/huanghuali/p/6145604.html
wow.js
http://mynameismatthieu.com/WOW/
https://github.com/matthieua/WOW
http://570109268.iteye.com/blog/2411836
https://www.cnblogs.com/yangjunfei/p/6746926.html
<link rel="stylesheet" type="text/css" href="css/animate.min.css">
<script type="text/javascript" src="js/wow.min.js"></script>
<script type="text/javascript">new WOW().init();</script>
<div class="wow slideInLeft" data-wow-duration="2s" data-wow-delay="5s" data-wow-offset="10" data-wow-iteration="10"></div>
类名前面的wow是每一个带动画的元素都要加的,slideInLeft就是说明动画样式。后面的data-wow-duration(动画持续时间)、data-wow-delay(动画延迟时间)、data-wow-offset(元素的位置露出后距离底部多少像素执行)和data-wow-iteration(动画执行次数)这四个属性可选可不选。
fullpage滚动到第二屏后wow失效的解决方法:
1、fullpage配置中 scrollBar : true
2、css body{overflow:hidden !important;}
jquery.fullpage.js
使用方法:
详细 https://www.cnblogs.com/EnSnail/p/5880385.html
http://www.dowebok.com/77.html
https://www.cnblogs.com/windy-xmwh/p/8279635.html
演示 http://www.shouce.ren/post/view/id/113203
https://www.jb51.net/article/98824.htm
说明,演示 http://www.jq22.com/jquery-info1124
可免费商用的字体
http://www.ui.cn/detail/244532.htm 带网盘下载地址
https://wenku.baidu.com/view/c46682d80408763231126edb6f1aff00bed570b9.html
http://www.360doc.com/content/17/0412/17/40067071_645076870.shtml
金山云技术体 https://design.ksyun.com/font
CSS vertical-align:middle 没有绝对垂直居中的解决办法
<div style="border:1px solid red;height:100px;"> <img src="abc.jpg" height="80" style="vertical-align:middle;"> </div>
实际使用中,我们会发现上面的 img 并没有绝对垂直居中,而是图片顶部多几个像素,解决方法很简单,就是给 img 的父元素 div 加上 font-size:0; 即可。