'JavaScript' 카테고리의 다른 글
| Simple JavaScript Inheritance (2) | 2012.01.02 |
|---|---|
| JSONP로 데이타 처리하기. (1) | 2011.12.12 |
| callback.call()에 대해서 (0) | 2011.11.10 |
| Simple JavaScript Inheritance (2) | 2012.01.02 |
|---|---|
| JSONP로 데이타 처리하기. (1) | 2011.12.12 |
| callback.call()에 대해서 (0) | 2011.11.10 |
| jQuery Carousel - modular (2) | 2012.11.27 |
|---|---|
| has(), is() (0) | 2012.07.22 |
| jQuery 플러그인과 그 메서드들을 만들기 위한 기본구조.. (0) | 2012.01.01 |
| jQuery 플러그인들 수집 (0) | 2011.12.28 |
| jQuery Template (0) | 2011.12.27 |
| jQuery() 함수 인자들 정리 (0) | 2011.11.07 |
http://www.gougouzian.fr/projects/jquery/moodular/
<ul id="demo">
<li>
<img src="img/photo01.jpg" />
</li>
<li>
<img src="img/photo02.jpg" />
</li>
<li>
<img src="img/photo03.jpg" />
</li>
<li>
<img src="img/photo04.jpg" />
</li>
<li>
<img src="img/photo05.jpg" />
</li>
<li>
<img src="img/photo06.jpg" />
</li>
</ul>
The CSS is :
#demo, #demo li { margin:0; padding:0; width:900px; height:495px; list-style:none; }
#demo { overflow: hidden; }
#demo li { float:left; }
The JavaScript is :
jQuery('#demo').moodular({
effects: 'left',
controls: '',
auto: true,
easing: '',
speed: 1000,
dispTimeout: 3000
});
| Mouse Wheel (0) | 2012.11.27 |
|---|---|
| has(), is() (0) | 2012.07.22 |
| jQuery 플러그인과 그 메서드들을 만들기 위한 기본구조.. (0) | 2012.01.01 |
| jQuery 플러그인들 수집 (0) | 2011.12.28 |
| jQuery Template (0) | 2011.12.27 |
| jQuery() 함수 인자들 정리 (0) | 2011.11.07 |
.has(selector)
자식요소로 selector를 가진 것들로 선택범위 축소
ex) $('.title').has($(this))
http://api.jquery.com/has/
.is(selector)
선택요소의 성질이 맞는지 boolean 리턴
ex) $('#container').is(':visible')
http://api.jquery.com/is/
| Mouse Wheel (0) | 2012.11.27 |
|---|---|
| jQuery Carousel - modular (2) | 2012.11.27 |
| jQuery 플러그인과 그 메서드들을 만들기 위한 기본구조.. (0) | 2012.01.01 |
| jQuery 플러그인들 수집 (0) | 2011.12.28 |
| jQuery Template (0) | 2011.12.27 |
| jQuery() 함수 인자들 정리 (0) | 2011.11.07 |
(function(){
var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
// The base Class implementation (does nothing)
this.Class = function(){};
// Create a new Class that inherits from this class
Class.extend = function(prop) {
var _super = this.prototype;
// Instantiate a base class (but only create the instance,
// don't run the init constructor)
initializing = true;
var prototype = new this();
initializing = false;
// Copy the properties over onto the new prototype
for (var name in prop) {
// Check if we're overwriting an existing function
prototype[name] = typeof prop[name] == "function" &&
typeof _super[name] == "function" && fnTest.test(prop[name]) ?
(function(name, fn){
return function() {
var tmp = this._super;
// Add a new ._super() method that is the same method
// but on the super-class
this._super = _super[name];
// The method only need to be bound temporarily, so we
// remove it when we're done executing
var ret = fn.apply(this, arguments);
this._super = tmp;
return ret;
};
})(name, prop[name]) :
prop[name];
}
// The dummy class constructor
function Class() {
// All construction is actually done in the init method
if ( !initializing && this.init )
this.init.apply(this, arguments);
}
// Populate our constructed prototype object
Class.prototype = prototype;
// Enforce the constructor to be what we expect
Class.prototype.constructor = Class;
// And make this class extendable
Class.extend = arguments.callee;
return Class;
};
})();
var Person = Class.extend({
init: function(isDancing){
this.dancing = isDancing;
},
dance: function(){
return this.dancing;
}
});
var Ninja = Person.extend({
init: function(){
this._super( false );
},
dance: function(){
// Call the inherited version of dance()
return this._super();
},
swingSword: function(){
return true;
}
});
var p = new Person(true);
p.dance(); // => true
var n = new Ninja();
n.dance(); // => false
n.swingSword(); // => true
// Should all be true
p instanceof Person && p instanceof Class &&
n instanceof Ninja && n instanceof Person && n instanceof Class
| HTML5 File Drag & Drop API (0) | 2013.10.30 |
|---|---|
| JSONP로 데이타 처리하기. (1) | 2011.12.12 |
| callback.call()에 대해서 (0) | 2011.11.10 |
<div class="test" id="XX"></div>
<div class="test" id="YY"></div>
<script>
$.fn.plug = function(){
var o = this;
o.html("AA");
o.aa = function(){
alert(o===this); // true
o.each(function(i, k){
$(k).html(i+"th : "+k.id);
});
}
return o;
}
var x = $('.test').plug();
</script>
<input type="button" onclick="x.aa()">
| Mouse Wheel (0) | 2012.11.27 |
|---|---|
| jQuery Carousel - modular (2) | 2012.11.27 |
| has(), is() (0) | 2012.07.22 |
| jQuery 플러그인들 수집 (0) | 2011.12.28 |
| jQuery Template (0) | 2011.12.27 |
| jQuery() 함수 인자들 정리 (0) | 2011.11.07 |
| Mouse Wheel (0) | 2012.11.27 |
|---|---|
| jQuery Carousel - modular (2) | 2012.11.27 |
| has(), is() (0) | 2012.07.22 |
| jQuery 플러그인과 그 메서드들을 만들기 위한 기본구조.. (0) | 2012.01.01 |
| jQuery Template (0) | 2011.12.27 |
| jQuery() 함수 인자들 정리 (0) | 2011.11.07 |
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script>
</head>
<body>
<script id="movieTemplate" type="text/x-jquery-tmpl">
<li>
Title: ${Name} ${index}
{{each Languages}}
${$index + 1}: <em>${$value}. </em>
{{/each}}
</li>
</script>
<ul id="movieList"></ul>
<script>
var movies = [
{ Name: "Meet Joe Black", Languages: ["French"] },
{ Name: "The Mighty", Languages: [] },
{ Name: "City Hunter", Languages: ["Mandarin", "Cantonese"] }
];
/* Render the template with the movies data */
$( "#movieTemplate" ).tmpl( movies )
.appendTo( "#movieList" );
</script>
</body>
</html>
| Mouse Wheel (0) | 2012.11.27 |
|---|---|
| jQuery Carousel - modular (2) | 2012.11.27 |
| has(), is() (0) | 2012.07.22 |
| jQuery 플러그인과 그 메서드들을 만들기 위한 기본구조.. (0) | 2012.01.01 |
| jQuery 플러그인들 수집 (0) | 2011.12.28 |
| jQuery() 함수 인자들 정리 (0) | 2011.11.07 |
jQuery.getJSON("http://altvirus.com/jsonp.php?callback=?",
function(data) {
alert(data.b);
});
<?
$arr = array('a'=>'XX', 'b'=>100);
$jsonData = json_encode($arr);
echo $_GET['callback'] . '(' . $jsonData . ');';
?>
| HTML5 File Drag & Drop API (0) | 2013.10.30 |
|---|---|
| Simple JavaScript Inheritance (2) | 2012.01.02 |
| callback.call()에 대해서 (0) | 2011.11.10 |