- $( document ).ready( handler )
- $().ready( handler ) (this is not recommended)
- $( handler )
1 2 3 4 5 6 7 8 9 10 | < script type = "text/javascript" > yepnope([{ load: [ '/js/jquery/1.10.2/jquery.min.js' ], complete: function() { // 코드. } }]); </ script > |

이 경우 간단한 해결방법은 jQuery 의 proxy() 를 사용하는 것이다. 다음의 코드를 보자.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | < script type = "text/javascript" > var jobs = []; $(document).ready(function(){ // code var initilizer, _i, _len; for (_i = 0, _len = jobs.length; _i < _len ; _i++) { initilizer = jobs [_i]; $.proxy(initilizer, this)(); } }); </script> < script type = "text/javascript" > jobs.push(function(){ // code 1 }); </ script > |
댓글 없음:
댓글 쓰기