2015. 11. 17. 14:31

- 모바일 a링크 클릭시 영역을 나타내는 하이라이트 제거방법





 -webkit-tap-highlight-color: transparent;


** 여기서 하이라이트 배경색도 변경 가능하다!


Posted by miLove
2015. 10. 13. 13:38

html

 
  

css

 
   .banner_wrap{position:relative; padding:100px}
	.banner_wrap .btn{display:block; width:50px; height:50px; position:absolute; left:30px; top:120px;}
	.banner_wrap .btn.btn_next{position:absolute; left:330px; top:120px;}
	.banner_wrap .banner{overflow:hidden; width:200px; height:100px}
	.banner_wrap .banner ul{*zoom:1; wid th:600px;}
	.banner_wrap .banner ul:after{display:block; content:""; clear:both;}
	.banner_wrap .banner ul li{float:left; width:200px; height:100px; background-color:#fff;}
	.indicator{width:200px; margin-top:10px; text-align:center;}
	.indicator a{display:inline-block; margin:0 2px; border:1px solid #fff; width:14px; height:14px; border-radius:10px; background-color:#fff;}
	.indicator a.on{border:1px solid #bc6848;  background-color:#bc6848; }

jquery

 
 $(document).ready(function(){
	// li갯수
	var liLength = $(".banner ul li").size();

	// ul 넓이
	var ulWidth = 200* liLength
	$(".banner ul").css("width",ulWidth+"px")

	// 좌우 버튼 
	$(".btn_prev").click(function(){
		if($(".banner ul").css("margin-left") == "0px"){
			$(".banner ul").css("margin-left","0");
			indicator();
		}else{
				//조건시작
				if(!$(".banner ul").is(":animated")){
					$(".banner ul").animate({"margin-left":"+=200"},500,function(){
						indicator();
					});
				}
				//조건끝		
			}
	});
	
	$(".btn_next").click(function(){
		if($(".banner ul").css("margin-left") == "-"+(ulWidth-200)+"px"){
			$(".banner ul").css("margin-left","-"+(ulWidth-200)+"px");
			indicator();
		}else{
			//조건시작
			if(!$(".banner ul").is(":animated")){
				$(".banner ul").animate({"margin-left":"-=200"},500,function(){	
					indicator();
				});	
			}
			//조건끝			
		}	
	});
	
	// indicator Length
	for(var i=0 ; i");
		}else{
			$(".indicator").append("");
		}
	}

	// indicator index 
	$(".indicator a").click(function(){
		var paging = $(this).index();
		$(".banner ul").animate({"margin-left":paging*-200+"px"},500);
		$(".indicator a").removeClass("on");
		$(".indicator a").eq(paging).addClass("on");
	});

	//좌우indicator 함수
	function indicator(){
		var leftPosition = parseInt($(".banner ul").css("margin-left"));	//parseInt 숫자값으로 변환 	
		var anchorIndex = -(leftPosition/200);
		//var anchorIndex = Math.abs(leftPosition/200);
		$(".indicator a").removeClass("on");
		$(".indicator a").eq(anchorIndex).addClass("on");	
		//$(".indicator a").eq(-( parseInt($(".banner ul").css("margin-left"))/200)).addClass("on"); 
	}
	
});
Posted by miLove
2015. 8. 28. 17:38

4. 탭메뉴 리스트 속에 컨텐즈 존재하게 !! li 안에 div 구조로

html

 
  • 1번탭내용
  • 2번탭내용
  • 3번탭내용
  • 4번탭내용




css

 
   ul,li{list-style:none}
	.tab{position:relative;overflow:hidden;height:500px}
	.tab li{float:left;width:63px;border:1px solid #fff}
	.tab li a{display:block;width:63px;height:50px;line-height:50px;text-align:center}
	.tab li  div{display:none; width:100%;height:500px;position:absolute;left:100px;top:100px;}
	.tab li:nth-child(2) div{display:none}
	.tab li:nth-child(3) div{display:none}
	.tab li:nth-child(4) div{display:none}
	.tab li.on div{display:block;}

js

 
$(function(){
	 $(function(){
	$('.tab li').click(function(){
		var tabType = $(this).index();
		
		$('.tab li').each(function(index){
			$(this).find('img').attr('src', $(this).find('img').attr('src').replace('_off','_on'));
			
			if(tabType != index){
				$(this).find('img').attr('src', $(this).find('img').attr('src').replace('_on','_off'));
			}

		});

			
			//on class 없이도 제어  
			//$('.tab div').hide();
			//$('.tab div').eq(tabType).show();


		//class li에 on제어 
		$('.tab li').removeClass('on');
		$('.tab li').eq(tabType).addClass('on');	



	});


 });




css로 on 클레스 만들어서 사용하는게 더 효과적이다. !



Posted by miLove
2015. 8. 28. 17:32

3. 이미지로 된 탭메뉴

html

1번탭내용
2번탭내용
3번탭내용
4번탭내용

css

 
 ul,li{list-style:none}
	.tab{overflow:hidden}
	.tab li{float:left;width:63px;border:1px solid #fff}
	.tab li a{display:block;width:100%;height:50px;line-height:50px;text-align:center}
	.con_wrap{position:relative;height:200px;border:1px solid red}
	.con_wrap div{position:absolute;left:0;top:0;}
	.con_wrap div:nth-child(2){display:none}
	.con_wrap div:nth-child(3){display:none}
	.con_wrap div:nth-child(4){display:none}

js

 
$(function(){
	$('.tab li').click(function(){
		
		var tabType = $(this).index();
		
			$('.tab li').each(function(index){
			$(this).find('img').attr('src', $(this).find('img').attr('src').replace('_off','_on'));
			if(tabType != index){
				$(this).find('img').attr('src', $(this).find('img').attr('src').replace('_on','_off'));
			}
		});

			$('.con_wrap>div').eq(tabType).show().siblings('div').hide();

	});


 });
Posted by miLove
2015. 8. 26. 17:53

2. 클래스없이 탭메뉴

html


1번탭내용
2번탭내용
3번탭내용
4번탭내용

css

 ul,li{list-style:none}
	.tab{overflow:hidden}
	.tab li{float:left;width:33%;border:1px solid #fff}
	.tab li a{display:block;width:100%;height:50px;line-height:50px;background:pink;text-align:center}
	.tab li a.on{background:blue}
	.con_wrap{position:relative;height:200px;border:1px solid red}
	.con_wrap div{position:absolute;left:0;top:0;}
	.con_wrap div:nth-child(2){display:none}
	.con_wrap div:nth-child(3){display:none}
	.con_wrap div:nth-child(4){display:none}

js

 
$(function(){
	$(".tab li").click(function(){
		

		var tabType = $(this).index();
		
		$('.con_wrap div').hide();
		$('.con_wrap div').eq(tabType).show();

		$('.tab a').removeClass('on');
		$('.tab a').eq(tabType).addClass('on');	
		
	})


 });

* TIP 

1. 선택한 태그가 몇번째 위치지인지 알수 있는 함수 

2. 특정 위치를 찾는 함수 




eq(n) : n번째로 일치하는 엘리먼트




Posted by miLove
2015. 8. 25. 11:21

1. 앵커로 탭메뉴

html


1번탭내용
2번탭내용
3번탭내용
4번탭내용

css

ul,li{list-style:none}
	.tab{overflow:hidden}
	.tab li{float:left;width:33%;border:1px solid #fff}
	.tab li a{display:block;width:100%;height:50px;line-height:50px;background:pink;text-align:center}
	.con_wrap{position:relative;height:200px;border:1px solid red}
	.con_wrap .con{position:absolute;left:0;top:0}
	.con_wrap .con:nth-child(2){display:none}
	.con_wrap .con:nth-child(3){display:none}
	.con_wrap .con:nth-child(4){display:none}

js

$(function(){
	$(".tab a").click(function(){
		
		var tabType=$(this).attr('href');
		$(tabType).show().siblings(".con").hide();
        })


 });

- click() 이벤트

클릭을 하면 이벤트를 발생


- attr() 메소드

attr(attribute) = attr(속성); - 속성의 값 가져오기

attr(attribute,value) = attr({속성:값, 속성:값}); - 대상의 속성을 값으로 설정

Posted by miLove
2014. 6. 19. 20:59

web용
- web에선 1줄 말줄임만 허용된다. ie7~ 모든브라우저에서 사용할수있다.
- width값으로 제어를 합니다.


[css]
  1. overflow: hidden;
  2. white-space: nowrap;
  3. text-overflow: ellipsis;
width
  1. width: 100px;



table
- 테이블에 텍스트로 길게 들어가는 부분에는 넓이가 colgroup에 없는데 그때 사용할수있다 

[html]
<table class="tbl">
   <caption><span class="blind">내가 쓴 덧글  목록</span></caption>
   <colgroup>
   <col style="width:94px">
   <col>
   <col style="width:67px">
   <col style="width:68px">
   <col style="width:94px">
   </colgroup>
   <thead>
   <tr>
   <th scope="col">쿠폰명</th>
   <th scope="col">이벤트명</th>
   <th scope="col">지급일</th>
   <th scope="col">사용가능기간</th>
   <th scope="col">받은아이템</th>
   </tr>
   </thead>
   <tbody>
   <tr>
    <tr>
   <td class="cp"><span>쿠폰명</span></td>
   <td class="evt"><a href="#">이벤트명이벤트명이벤트명이벤트명</a></td>
   <td class="date">12.03.15</td>
   <td class="date"> ~ 13.03.15</td>
   <td class="item">무기업그레이드</td>
   </tr>
   </tbody>
   </table>

[css]
            .my_info .tbl{
          1. table-layout: fixed;
          }

          .tbl .evt{
          1. overflow: hidden;
          2. white-space: nowrap;
          3. text-overflow: ellipsis;

          }



          mobile


          모바일_1줄 이상 말줄임 적용

          overflow: hidden;

          display: -webkit-box;

          -webkit-line-clamp: 4;/몇번째 줄에서 말줄임?

          -webkit-box-orient: vertical;

          word-wrap: break-word;



          Posted by miLove
          2014. 2. 3. 10:28

          요소 선택자

          :first-child /* 첫번재*/
          :last-child /*마지막*/
          
          :nth-child() /*가로안에 숫자를 집어넣어서 몇번째인지 정한다*/
          :nth-child(5n+1) /* 5개씩 자르고 그중 첫번째이다.(숫자는마음대로)*/
          div:nth-child(5n) /*5개씩 자르고 그중 5번째이다*/
          :nth-child(odd) /*홀수*/
          :nth-child(even) /*짝수*/
          :nth-of-type(숫자) /*nth-child랑 비슷한데 다른점은 dl dt dd 같이 묶여있는건 nth-child 가 반응을못한다 그땐 nth-of-type()을 쓰면 된다*/
          :not(:first-child) /*첫번째께 아닐경우*/
          
          Posted by miLove
          2014. 1. 29. 10:18

          select, input등 form요소의 기본속성 초기화방법

          select, input등에 원치않는 그라데이션과 라운드가 처리되어 있고, input 크롬 브라우저에서 주황색 테두리가 나올때 form 요소의 기본속성을 초기화하는 방법입니다.
          input-type:number ▲▼

          • 폰으로 확인화면 눈으로 확인할수있다 !

          css

          input{outline-style:none;} /*크롬 브라우져 input 주황색 테두리 없애는법*/
          border-radius:0px 0px; /* 아이폰의 input 라운드 초기화 */
          -webkit-appearance:none; /* form 요소의 디바이스 기반 스타일 초기화 */ 
          

          Posted by miLove
          2014. 1. 29. 10:09

          뷰포트 제어

          모든숫자가 파랑색 글씨로 나올경우

          html

          
          

          Posted by miLove
          2014. 1. 29. 09:51

          display:table, table-cell
          -webkit-box를 이용하여 구조 만들기

          기본적으로 %별로 만들고 분할하여 사용하는 방식


          기본 splitCell, splitBox를 이용해서 나누는경우(10등분기준)

          *
          *
          *



          txt 흰색배경에 텍스트가 들어갈경우

          point
          point


          mix일경우(form + text가 들어갈경우) - 유동적임

          :

          ~
          ~

          
          


          CSS 전체코드

          /** FORMTYPE SPLIT **/
          /* base */
          .splitCell{display:table; width:100%;}
          .splitCell>*{display:table-cell; padding:0 0.17em; vertical-align:middle;}
          .splitBox{display: -webkit-box; -webkit-box-pack:justify; -webkit-box-align:center;}
          .splitBox>*{display:block; margin:0 0.17em; -webkit-box-flex:1;}
          .formType input + .splitBox, .formType input + .splitCell{margin-top:1.06em;}
          /* input+bgWhiteText */
          .splitBox.txt{-webkit-box-align:end;}
          .splitCell.txt>*{padding:0;}
          .splitCell.txt>*.txtR, 
          .splitCell.txt>*.txtL, 
          .splitBox.txt>*.txtR+*, 
          .splitBox.txt>*.txtL+*{height:23px; background:#fff; color:#999; font-weight:bold; font-size:0.74em; vertical-align:middle; display:table-cell;}
          .splitBox.txt>*.txtR+*{padding-right:0.64em; text-align:right;}
          .splitBox.txt>*.txtL+*{padding-left:0.64em; text-align:left;}
          /* input+text - mix */
          .splitBox.mix div{-webkit-box-flex:150;}
          .splitBox.mix span{font-size:0.64em; color:#444;}
          /* first/last space none */
          .splitBox>*:first-child,
          .splitCell>*:first-child,
          .splitBox.txt>*.txtL{margin-left:0; padding-left:0;}
          .splitBox>*:last-child,
          .splitCell>*:last-child,
          .splitBox.txt>*.txtR{margin-right:0; padding-right:0;}
          
          /*input_margin_left > btn*/
          .btn_ml .splitBox>* {margin-right:0.43em;}
          
          /* col_size */
          .aiCol>*:nth-child(1),
          .dax2Col>*:nth-child(even){width:10%;}
          .ddbCol>*:nth-child(3),
          .bhCol>*:nth-child(1),
          .hbCol>*:nth-child(2){width:20%;}
          .ax4Col>*{width:25%;}
          .dccCol>*,
          .cgCol>*:nth-child(1),
          .gcCol>*:nth-child(2){width:30%;}
          .ddbCol>*,
          .fdCol>*:nth-child(2),
          .dfCol>*:nth-child(1),
          .dccCol>*:nth-child(1), 
          .dax2Col>*:nth-child(odd){width:40%;}
          .eeCol>*{width:50%;}
          .fdCol>*:nth-child(1),
          .dfCol>*:nth-child(2){width:60%;}
          .cgCol>*:nth-child(2),
          .gcCol>*:nth-child(1){width:70%;}
          .bhCol>*:nth-child(2),
          .hbCol>*:nth-child(1){width:80%;}
          .aiCol>*:nth-child(2){width:90%;}
          


          Posted by miLove
          2014. 1. 28. 14:15

          박스스타일display: -webkit-box

          좌우 균등 display: -webkit-box(부모에게 꼭적어라!) -webkit-box-pack:justify; (좌우균등)

          css

          .tab{
                 margin-bottom: 1.71em;
                -webkit-box-align:center;
                display: -webkit-box;}
          .tab > li {
                -webkit-box-flex: 1;
                font-size: 0.92em;
                text-align: center;
                border: 1px solid #ccc;}
          .tab > li.on {
               font-weight: bold;
               background: #8a7a6c;
               border: 1px solid #8a7a6c;
               color: #fff;}
          .tab > li a {
               padding: 0.89em 0;
               display: block;color: #222;}
          

          html

          
          

          Posted by miLove