'Front-End/J-Query'에 해당되는 글 8건
-
Jquery 기본 문법
2017.10.23 -
w3schools - templates
2017.07.06 -
jQuery Misc
2017.07.06 -
jQuery AJAX
2017.07.06 -
jQuery Traversing
2017.07.06 -
jquery HTML
2017.07.06 -
jQuery Effects
2017.07.06 -
jQuery Tutorial
2017.07.01
Jquery 기본 문법
<script>
$(document).ready(function(){
... jQuery 메소드, 액션을 입력 ...
});
</script>
<script>
$(function(){
... jQuery 메서드, 액션을 입력 ...
});
</script>
출처 : http://theqoop.tistory.com/295
'Front-End > J-Query' 카테고리의 다른 글
w3schools - templates (0) | 2017.07.06 |
---|---|
jQuery Misc (0) | 2017.07.06 |
jQuery AJAX (0) | 2017.07.06 |
jQuery Traversing (0) | 2017.07.06 |
jquery HTML (0) | 2017.07.06 |
w3schools - templates
https://www.w3schools.com/w3css/w3css_templates.asp
'Front-End > J-Query' 카테고리의 다른 글
Jquery 기본 문법 (0) | 2017.10.23 |
---|---|
jQuery Misc (0) | 2017.07.06 |
jQuery AJAX (0) | 2017.07.06 |
jQuery Traversing (0) | 2017.07.06 |
jquery HTML (0) | 2017.07.06 |
jQuery Misc
다른 자바스크립트 프레임워크와 충돌방지
jQuery - The noConflict() Method
jQuery and Other JavaScript Frameworks
The jQuery noConflict() Method
- js프레임워크 충돌방지
'Front-End > J-Query' 카테고리의 다른 글
Jquery 기본 문법 (0) | 2017.10.23 |
---|---|
w3schools - templates (0) | 2017.07.06 |
jQuery AJAX (0) | 2017.07.06 |
jQuery Traversing (0) | 2017.07.06 |
jquery HTML (0) | 2017.07.06 |
jQuery AJAX
jQuery - AJAX Introduction
jQuery AJAX Example - AJAX 서버에서 값 가져오기
What is AJAX?
What About jQuery and AJAX?
jQuery - AJAX load() Method
jQuery load() Method
jQuery AJAX Reference
jQuery - AJAX get() and post() Methods
HTTP Request: GET vs. POST
- GET - Requests data from a specified resource // 검색결과 url 뒤에 붙음
- POST - Submits data to be processed to a specified resource // 비밀번호
jQuery $.get() Method
Tip: Here is how the ASP file looks like ("demo_test.asp"):
<%
response.write("This is some text from an external ASP file.")
%>
jQuery $.post() Method
Syntax:
$.post(URL,data,callback);
dim fname,city
fname=Request.Form("name")
city=Request.Form("city")
Response.Write("Dear " & fname & ". ")
Response.Write("Hope you live well in " & city & ".")
%>
jQuery AJAX Reference
'Front-End > J-Query' 카테고리의 다른 글
w3schools - templates (0) | 2017.07.06 |
---|---|
jQuery Misc (0) | 2017.07.06 |
jQuery Traversing (0) | 2017.07.06 |
jquery HTML (0) | 2017.07.06 |
jQuery Effects (0) | 2017.07.06 |
jQuery Traversing
핵심 특정 엘리먼트만 선택한다
jQuery Traversing - 조상으로 이동 상위로
DOM tree 내에서 종횡무진 하기
jQuery Traversing Methods
jQuery Traversing - Ancestors
- 조상으로부터 올라감
Traversing Up the DOM Tree
- parent() // 부모
- parents() // 부모들
- parentsUntil() // 유틸
jQuery parent() Method - 지정된 부모만 엘리 선택
jQuery parents() Method - 지정된 엘리 상위 모두 선택
Traversing Down the DOM Tree
- children()
- find()
jQuery children() Method
jQuery find() Method - 검색해서 선택
jQuery Traversing - Siblings -
같은 형제끼리 이동(옆으로 이동)
Traversing Sideways in The DOM Tree
- siblings() // 형제끼리 이동
- next() // 다음에 오는거
- nextAll() // 다음에 오는거 전부
- nextUntil() // 다음에 어디까지
- prev() // 그전에
- prevAll() // 그전에 모두
- prevUntil() // 그전에 어디까지
jQuery siblings() Method
jQuery next() Method - 그 다음꺼만 리턴
jQuery nextAll() Method - 그 다음꺼 전부
jQuery nextUntil() Method - 사이에꺼만 선택
jQuery prev(), prevAll() & prevUntil() Methods
The prev(), prevAll() and prevUntil() methods work just like the methods above but with reverse functionality: they return previous sibling elements (traverse backwards along sibling elements in the DOM tree, instead of forward).
jQuery Traversing - Filtering
- CSS 선택해서 골라서 이동
The first(), last(), eq(), filter() and not() Methods
jQuery first() Method
jQuery last() Method - 마지막꺼만 선택
jQuery eq() method - 숫자로 선택(0부터 순차적)
jQuery filter() Method - 필터 : 골라서 본다
jQuery not() Method - 그거 아닌것만 골라
'Front-End > J-Query' 카테고리의 다른 글
jQuery Misc (0) | 2017.07.06 |
---|---|
jQuery AJAX (0) | 2017.07.06 |
jquery HTML (0) | 2017.07.06 |
jQuery Effects (0) | 2017.07.06 |
jQuery Tutorial (0) | 2017.07.01 |
jquery HTML
jQuery - Get
jQuery - Get Content and Attributes
jQuery DOM Manipulation
Get Content - text(), html(), and val()
속성 요소를 Get 가져온다.
- text() - Sets or returns the text content of selected elements
- html() - Sets or returns the content of selected elements (including HTML markup)
- val() - Sets or returns the value of form fields
기존에 있었던거에서 새롭게 셋팅한다.
(Set)
Set Content - text(), html(), and val()
We will use the same three methods from the previous page to set content:
- text() - Sets or returns the text content of selected elements
- html() - Sets or returns the content of selected elements (including HTML markup)
- val() - Sets or returns the value of form fields
The following example demonstrates how to set content with the jQuery text(), html(), and val() methods:
Set Attributes - attr() - href 속성 변경하기 콜백
<script>
$(document).ready(function(){
$("button").click(function(){ // 하이퍼 레퍼런스 href 속성 url 변경
$("#w3s").attr("href", "https://www.w3schools.com/jquery"); //W3Schools 변경
});
});
</script>
</head>
<body>
<p><a href="https://www.w3schools.com" id="w3s">W3Schools.com</a></p>
<button>Change href Value</button>
<p>Mouse over the link (or click on it) to see that the value of the href attribute has changed.</p>
</body>
</html>
A Callback Function for attr()
jQuery - Add Elements -
엘리먼트(컨텐츠) 추가
- append() - Inserts content at the end of the selected elements // 컨텐츠를 뒷부분에 추가
- prepend() - Inserts content at the beginning of the selected elements // 앞부분에 추가
- after() - Inserts content after the selected elements // 뒷부분 추가
- before() - Inserts content before the selected elements // 앞부분 추가
jQuery append() Method - 뒷부분 추가
jQuery prepend() Method - 앞부분에 컨텐츠 추가
Add Several New Elements With append() and prepend() - JQuery 에서 새로운 엘리먼트 추가
jQuery after() and before() Methods
Add Several New Elements With after() and before() - 각각 엘리먼트 속성에 따라 추가하는 방법
- remove() - Removes the selected element (and its child elements) // 모두 없어짐
- empty() - Removes the child elements from the selected element // 자식만 없어짐
jQuery remove() Method - 모두 없어짐
jQuery empty() Method -자식 엘리만 없어짐
Filter the Elements to be Removed - 필더
jQuery - CSS Classes (CSS 다루기)
jQuery - Get and Set CSS Classes
jQuery Manipulating CSS
- addClass() - Adds one or more classes to the selected elements // 지정된 클라스 추가
- removeClass() - Removes one or more classes from the selected elements // 지정된 클라스 제거
- toggleClass() - Toggles between adding/removing classes from the selected elements
- // 토글 할때마다 +-
- css() - Sets or returns the style attribute // 속성값 반환
Example Stylesheet
font-weight: bold;
font-size: xx-large;
}
.blue {
color: blue;
}
jQuery removeClass() Method - 클라스 색깔 제거
jQuery toggleClass() Method - On Off
jQuery - css() Method
하나 이상의 속성값을 반환하거나 변경
Return a CSS Property - 객체의 속성을 반환(보여)
css("propertyname");
Set Multiple CSS Properties - 여러게 엘리 속성 변경
css({"propertyname":"value","propertyname":"value",...});
jQuery Dimension Methods
- width()
- height()
- innerWidth()
- innerHeight()
- outerWidth()
- outerHeight()
jQuery width() and height() Methods - w,h 면적값 반환
<script>
$(document).ready(function(){
$("button").click(function(){
var txt = "";
txt += "Width of div: " + $("#div1").width() + "</br>";
txt += "Height of div: " + $("#div1").height();
$("#div1").html(txt);
});
});
</script>
<style>
#div1 {
height: 100px;
width: 300px;
padding: 10px;
margin: 3px;
border: 1px solid blue;
background-color: lightblue;
}
</style>
</head>
<body>
<div id="div1"></div>
<br>
<button>Display dimensions of div</button>
<p>width() - returns the width of an element.</p>
<p>height() - returns the height of an element.</p>
</body>
</html>
jQuery innerWidth() and innerHeight() Methods
jQuery outerWidth() and outerHeight() Methods
jQuery More width() and height()
'Front-End > J-Query' 카테고리의 다른 글
jQuery Misc (0) | 2017.07.06 |
---|---|
jQuery AJAX (0) | 2017.07.06 |
jQuery Traversing (0) | 2017.07.06 |
jQuery Effects (0) | 2017.07.06 |
jQuery Tutorial (0) | 2017.07.01 |
jQuery Effects
jQuery Effects - Hide and Show - 효과(이벤트랑 다름)
jQuery hide() and show() - btn 선택 숨김 / btn 선택 보여줌
$("p").hide(); // p태그 선택하면 숨김
});
$("#show").click(function(){ // 도큐맨트 준비되면
$("p").show(); // p태그 선택 보여줌
});
$(selector).show(speed,callback); // 보여주는 속도 조절 가능
$("p").hide(1000); // 1000 = 1초
});
jQuery toggle() - 토글
});
jQuery Effects - Fading -
시각적효과 *
부드럽게 사라지거나 보여주거나 하는 기능
jQuery Fading Methods - 종류
With jQuery you can fade an element in and out of visibility.
jQuery has the following fade methods:
- fadeIn()
- fadeOut()
- fadeToggle()
- fadeTo()
jQuery fadeOut() Method - 사라짐
$(selector).fadeOut(speed,callback);
$("#div1").fadeOut(); //사라짐
$("#div2").fadeOut("slow"); // 느리게 옵션
$("#div3").fadeOut(3000); // 속도 지정 3000은 3초
});
jQuery fadeToggle() Method - 클릭에 따라 On Off
$(selector).fadeToggle(speed,callback);
$("#div1").fadeToggle(); // On Off
$("#div2").fadeToggle("slow"); // 느리게
$("#div3").fadeToggle(3000); //속도 지정
});
jQuery fadeTo() Method - 투명도
jQuery Sliding Methods - 종류
- slideDown()
- slideUp()
- slideToggle()
jQuery slideDown() Method
$(selector).slideDown(speed,callback);
jQuery slideUp() Method - 줄 올림
$(selector).slideUp(speed,callback);
jQuery slideToggle() Method - On Off
$(selector).slideToggle(speed,callback);
jQuery Effects - Animation
- 애니메이션
jQuery Animations - The animate() Method
$(selector).animate({params},speed,callback);
jQuery animate() - Using Pre-defined Values - 사전에 정의된 벨루값을 줄수있다
jQuery animate() - Uses Queue Functionality - 애니메이션 연결
jQuery Stop Animations - 효과 중지
jQuery stop() Method - 정지
jQuery Callback Functions - 효과가 끝났을때 실행되게 하는거
jQuery Callback Functions
jQuery - Chaining - 명령어를 여러개 연결해서 사용
'Front-End > J-Query' 카테고리의 다른 글
jQuery Misc (0) | 2017.07.06 |
---|---|
jQuery AJAX (0) | 2017.07.06 |
jQuery Traversing (0) | 2017.07.06 |
jquery HTML (0) | 2017.07.06 |
jQuery Tutorial (0) | 2017.07.01 |
jQuery Tutorial
JQuery - MOME
JQuery 는 JavaScritp 라이브 러리
JQuery - 적게 쓰고 자바스크립트 효과를 낸다
"Try it Yourself" Examples in Each Chapter - 제이쿼리 실행
jQuery Introduction
- HTML
- CSS
- JavaScript
What is jQuery? - jQuery 기능
- HTML/DOM manipulation
- CSS manipulation
- HTML event methods
- Effects and animations
- AJAX
- Utilities
Why jQuery?
jQuery Get Started - 실행방법
Adding jQuery to Your Web Pages
- Download the jQuery library from jQuery.com
- Include jQuery from a CDN, like Google
Downloading jQuery - 다운로드 방법
html 문서 내 <head>태그 안에 j-query src= 경로 작성
<head>
<script src="jquery-3.2.1.min.js">
</script>
</head>
기존
Do you wonder why we do not have type="text/javascript" inside the <script> tag?
text 사라진 이유??
html5 는 기본 디폴트 랭기지가 자바스크립트라서 text/javascript 없어도됨
참고 바람~
사용법 html <head> 태그에 주소 한줄 넣어주면 됨
jQuery CDN
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js">
</script>
</head>
MS
<head>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js">
</script>
</head>
jQuery Syntax - 문법
jQuery Syntax
Basic syntax is: $(selector).action()
- A $ sign to define/access jQuery
- A (selector) to "query (or find)" HTML elements
- A jQuery action() to be performed on the element(s)
Examples:
$(selector).action() // 준비
// 액션
$(this).hide() - hides the current element. // html 엘리먼트 현재 선택자
$("p").hide() - hides all <p> elements. // html p 태그 선택
$(".test").hide() - hides all elements with class="test". // 클래스
$("#test").hide() - hides the element with id="test". // 아이디 지정
제이쿼리 준비
$(document).ready(function(){
// jQuery methods go here...
});
The Document Ready Event - 이벤트 준비
// jQuery methods go here...
});
jQuery Selectors
The element Selector - html 선택자 선택 방법
$("p") // html 태그 제어
<!DOCTYPE html> // doctype을 html 지정
<html>
<head> // 헤드 태그 사이에 cdn 로딩
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){ // document 가 로딩되었는지 확인
$("button").click(function(){ // 버튼을 클릭했을때 펑션 작동
$("p").hide(); // btn 클릭했을때 p 태그가 히든 됨
});
});
</script>
</head>
<body>
<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button>Click me to hide paragraphs</button>
</body>
</html>
The #id Selector - html id 선택자
$("#test")
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("#test").hide();
});
});
</script>
</head>
<body>
<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<p id="test">This is another paragraph.</p>
<button>Click me</button>
</body>
</html>
The .class Selector - html class 선택자
More Examples of jQuery Selectors 방법
Syntax | Description | Example |
---|---|---|
$("*") | Selects all elements | |
$(this) | Selects the current HTML element | |
$("p.intro") | Selects all <p> elements with class="intro" | |
$("p:first") | Selects the first <p> element | |
$("ul li:first") | Selects the first <li> element of the first <ul> | |
$("ul li:first-child") | Selects the first <li> element of every <ul> | |
$("[href]") | Selects all elements with an href attribute | |
$("a[target='_blank']") | Selects all <a> elements with a target attribute value equal to "_blank" | |
$("a[target!='_blank']") | Selects all <a> elements with a target attribute value NOT equal to "_blank" | |
$(":button") | Selects all <button> elements and <input> elements of type="button" | |
$("tr:even") | Selects all even <tr> elements | |
$("tr:odd") | Selects all odd <tr> elements |
$("p:first") 처음 P태그만 선택한다.(여러가지 P태그중에 첫번째꺼만 선택)
$("ul li:first") ul에 li 중에 첫번째 한개만 선택한다.(ul 태그 안에 li태그중에 첫번째꺼만 선택) - 한개만
$("ul li:first-child") ul에서 첫번째 모두 li개수만큼 선택한다.(ul태그 안에 li태그 모두 선택) - li 모두
$("[href]") href 하이퍼 레퍼런스 모두 선택 href="http://www.w3school.com"
$("a[target='blank']") <p><a href="https://www.w3schools.com/html/" target="_blank">HTML Tutorial</a></p> 만 선택한다.
$("a[target!='blank']") != 부정연산자 target='blank 아닌것만 선택한다.
$(":button") 모든 버튼을 선택한다.
$("tr:even") tr태그 even 짝수 즉! 테이블 태그에서 짝수줄만 선택한다.
$("tr:odd") tr태그에서 odd 홀수 즉! 테이블 태그에서 홀수줄만 선택한다.
Functions In a Separate File 외부파일 불러오기
<head>
<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js">
</script>
<script src="my_jquery_functions.js">
</script>
</head>
제이쿼리 핵심 이벤트
j-Query Event Methods
Mouse Events | Keyboard Events | Form Events | Document/Window Events |
---|---|---|---|
click | keypress | submit | load |
dblclick | keydown | change | resize |
mouseenter | keyup | focus | scroll |
mouseleave | blur | unload |
jQuery Syntax For Event Methods
// action goes here!!
});
$(document).ready() // 제인쿼리 로딩 및 준비
click() 이벤트 사용법
$("p").click(function(){ // p태그 선택자 이벤트 클릭하면
$(this).hide(); // this = all 지금 hide 숨김
});
dblclick() 더블클릭 이벤트 사용법
$(this).hide(); // 더블클릭하는 선택자(객체) 그것을 this
});
alert("You entered p1!"); // mouseenter 마우스를 가져가면 alert("msg출력");
alert("Bye! You now leave p1!");// mouseleave 마우스를 때면 alert("msg출력");
});
alert("Mouse down over p1!"); // 마우스를 다운하면 alert 안에 msg 출력 ~
});
alert("Mouse up over p1!"); // 마우스를 업하면 alert 안에 msg 출력~
});
The on() Method
참고
https://www.w3schools.com/jquery/jquery_events.asp
제인쿼리 이벤트 레퍼런스 그때 그때 참고해서 사용하면됨
https://www.w3schools.com/jquery/jquery_ref_events.asp
'Front-End > J-Query' 카테고리의 다른 글
jQuery Misc (0) | 2017.07.06 |
---|---|
jQuery AJAX (0) | 2017.07.06 |
jQuery Traversing (0) | 2017.07.06 |
jquery HTML (0) | 2017.07.06 |
jQuery Effects (0) | 2017.07.06 |