• 회원가입
  • 로그인
  • 구글아이디로 로그인

[DOM_Style] JS - backgroundAttachment 속성 ★ - 배경이미지고정 설정/반환

목차
  1. backgroundAttachment 예제 - 배경이미지 고정 설정
  2. backgroundAttachment 정의
  3. backgroundAttachment 구문

 

backgroundAttachment 예제 - 배경이미지 고정 설정

 

<style>

body {

  background: Tomato url('https://i.imgur.com/PQNhCln.gif') no-repeat right top;

}

</style>


<body>


<h1>홈짱닷컴</h1>

<p>Homzzang.com</p>


<button onclick="homzzang()">클릭</button>

<p id='demo'></p>

 

<script>

function homzzang() {

  document.body.style.backgroundAttachment = "fixed";

}

var i = 0

var text = '';

for(i = 0; i < 30 ; i++) {

  text += "홈페이지 제작관리 + 서버관리<br>";

  document.getElementById('demo').innerHTML = text;

}

</script>

 

결과보기

 

backgroundAttachment 정의

 

배경이미지를 "고정시킬건지, 스크롤과 함께 움직이게 할건지" 설정/반환.

 


 

CSS background-attachment 속성 참고.

 

 

backgroundAttachment 구문

 

배경이미지 고정 반환

object.style.backgroundAttachment

 

배경이미지 고정 설정

object.style.backgroundAttachment = "scroll|fixed|local|initial|inherit"

 


[속성값]

 

CSS background-attachment 속성 참고.

 


[반환값]

 

배경이미지가 문서 안 객체에 어떤 식으로 부착되었는지 나타내는 문자열.

 

 


분류 제목
HTML_Objects JS - <iframe> 객체 ★ - 타웹페이지삽입 (= iframe태그 = 아이프레임태그)
HTML_Objects JS - <img> 객체 ★ - 사진/그림/이미지 (= img태그 = 이미지태그)
HTML_Objects JS - <ins> 객체 - 텍스트삽입표시 (= ins태그 = 인스태그 = 인서트태그)
HTML_Objects JS - <input type="button"> 객체 - button타입 input태그 (= 인풋버튼태그)
HTML_Objects JS - <input type="checkbox"> 객체 ★ - checkbox타입 input태그 (= 인풋…
HTML_Objects JS - <input type="color"> 객체 - color타입 input태그 (= 인풋컬러태그) ※ …
HTML_Objects JS - <input type="date"> 객체 - date타입 input태그 (= 인풋데이트태그) ※ 날…
HTML_Objects JS - <input type="datetime"> 객체 - datetime타입 input태그 (= 인풋데이…
HTML_Objects JS - <input type="datetime-local"> 객체 - datetime-local타입 inp…
HTML_Objects JS - <input type="email"> 객체 - email타입 input태그 (= 인풋이메일태그)
HTML_Objects JS - <input type="file"> 객체 ★ - file타입 input태그 (= 인풋파일태그) ※ …
HTML_Objects JS - <input type="hidden"> 객체 ★ - hidden타입 input태그 (= 인풋히든태그…
HTML_Objects JS - <input type="image"> 객체 ★ - image타입 input태그 (= 인풋이미지태그)…
HTML_Objects JS - <input type="month"> 객체 - month타입 input태그 (= 인풋먼스태그) ※ …
HTML_Objects JS - <input type="number"> 객체 - number타입 input태그 (= 인풋넘버태그) …
HTML_Objects JS - <input type="password"> 객체 - password타입 input태그 (= 인풋패스…
HTML_Objects JS - <input type="radio"> 객체 ★ - radio타입 input태그 (= 인풋라디오태그 …
HTML_Objects JS - <input type="range"> 객체 - range타입 input태그 (= 인풋레인지태그) ※…
HTML_Objects JS - <input type="reset"> 객체 - reset타입 input태그 (= 인풋리셋태그) ※ …
HTML_Objects JS - <input type="search"> 객체 - search타입 input태그 (= 인풋서치태그) …
57/67
목록
찾아주셔서 감사합니다. Since 2012