2016年12月9日 星期五

owlcarousel 100%高的用法

1. 先去GITHUB 下載 owlcarousel 2.0新版
https://github.com/OwlCarousel2/OwlCarousel2

2. 把CSS放到html裡面
CSS 放到<head>裡面

<link rel="stylesheet" href="dist/owlcarousel/owl.carousel.min.css">

<link rel="stylesheet" href="dist/owlcarousel/owl.theme.default.min.css">


3. JS 放到<body>最下面,記得要先引用jquery

<!-- jQuery -->
<script src="//code.jquery.com/jquery.js"></script>

<!--貓頭鷹跑馬燈的JS-->
<script src="dist/owlcarousel/owl.carousel.min.js"></script>
<!--啟用貓頭鷹-->
<script>
$('.owl-carousel').owlCarousel({
loop:true,
margin:10,
nav:true,
items:1
})
</script>
4. html 我用背景的跑馬燈
<div class="owl-carousel">
    <div class="item" style="background-image: url(img/b1.jpg);"><h4>1</h4></div>
    <div class="item" style="background-image: url(img/b2.jpg);"><h4>2</h4></div>
</div>
5. 100高的設定 100% height CSS 設定

html,body{height: 100%;}
body{min-height:100%;}
.owl-carousel{height: 100%;}
.owl-carousel .owl-stage-outer{height: 100%;}
.owl-stage{height: 100%;}
.owl-item {height: 100%;}
.owl-item .item{height: 100%; background-size: cover;background-position: center center;}

2016年11月29日 星期二

圖片置中的好方法,Image Vertical Align

外層DIV 高度與行高一致
裡面的IMG vertical-align:middle

.proudImg{margin:10px;overflow: hidden;height: 200px;line-height:200px;}
.proudImg img{vertical-align:middle;}

2016年11月17日 星期四

RWD

媒體查詢寫法

最大的畫面只到767 手機專用
@media only screen and (max-width: 767px){
}

最大的畫面只到991 平板專用
@media only screen and (max-width: 991px){
}
畫面在1200~992
@media(min-width: 768px) and (max-width: 1200px){
}

2016年11月16日 星期三

css hover 過後 圖片放大的感覺

a img{
-webkit-transition: top .8s ease-out,left .8s ease-out,opacity .8s ease-out,-webkit-transform .8s ease-out;
    -moz-transition: top .8s ease-out,left .8s ease-out,opacity .8s ease-out,-webkit-transform .8s ease-out;
    -o-transition: top .8s ease-out,left .8s ease-out,opacity .8s ease-out,-webkit-transform .8s ease-out;
    transition: top .8s ease-out,left .8s ease-out,opacity .8s ease-out,-webkit-transform .8s ease-out;
    -ms-transform: scale(1);
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    -o-transform: scale(1);
    transform: scale(1);
}

a:hover img{
 -ms-transform: scale(1.02);
    -webkit-transform: scale(1.02);
    -moz-transform: scale(1.02);
    -o-transform: scale(1.02);
    transform: scale(1.02);
}

http://www.erikjohanssonphoto.com/work

2016年11月4日 星期五

一些注意事項

1. img 放在DIV 裡,底部多出一段padding
Ans: img display:block

2.slidebar 好用的js  側開 上開 下開
Adam Charles Smith
 https://www.adchsm.com/slidebars/

2016年3月20日 星期日

按鈕翻滾的CSS

CSS

.textbutton {
display:block;
    line-height: 51px;
    color: #fff;
    text-align: center;
    letter-spacing: -.5px;
    font-size: 17px;
    width: 100%;
}
.textbutton {
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
    -webkit-transform-origin: center center;
    -ms-transform-origin: center center;
    transform-origin: center center;
    -webkit-transition: all .35s ease;
    transition: all .35s ease;
    -webkit-transform: rotateX(0) translateZ(25px) scale(.975);
    transform: rotateX(0) translateZ(25px) scale(.975);
    background: #248328;
}
 .textbutton:hover {
    -webkit-transform: rotateX(-90deg) translateZ(25px) scale(.975);
    transform: rotateX(-90deg) translateZ(25px) scale(.975);
    background: #133a15;
}
.textbutton:after {
    content: '成立宗旨與理念';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    background: #133a15;
    -webkit-transform: translateY(-25px) translateZ(-25px) rotateX(90deg);
    transform: translateY(-25px) translateZ(-25px) rotateX(90deg);
    -webkit-transition: all .35s ease;
    transition: all .35s ease;
}
.textbutton:hover:after {
    background: #248328;
}

HTML

<a href="#" class="textbutton">成立宗旨與理念</a>

2015年12月19日 星期六

滑開感覺動作css

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">

<style>
.header ul li {
    display: inline;
}
.header ul a {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    width: 30px;
    -webkit-transition: color .25s ease-in-out, width .25s ease-in-out;
    -moz-transition: color .25s ease-in-out, width .25s ease-in-out;
    -ms-transition: color .25s ease-in-out, width .25s ease-in-out;
    -o-transition: color .25s ease-in-out, width .25s ease-in-out;
    transition: color .25s ease-in-out, width .25s ease-in-out;
}
.header ul a.active, .header ul a:hover {
    width: 150px;
}
.header .fa{ width:30px;}
</style>



html 部分

<div class="header">
<ul>
<li><a href="#"><i class="fa fa-anchor"></i><span>投資組合</span></a></li>
<li><a href="#"><i class="fa fa-bell-o"></i><span>下午7時26分</span></a></li>
<li><a href="#"><i class="fa fa-taxi"></i><span>日出</span></a></li>
<li><a href="#"><i class="fa fa-cogs"></i><span>背景</span></a></li>
</ul>
</div>

示意圖