0
이 코드가 무엇을 이해하지 못했다 :아래의 코드는 무엇을 의미합니까?
.bind(this);
이
.on('mouseleave.fndtn.dropdown', '[data-dropdown], [data-dropdown-content]', function (e) {
var $this = $(this);
self.timeout = setTimeout(function() {
if ($this.data('dropdown')) {
var settings = $this.data('dropdown-init');
if (settings.is_hover) self.close.call(self, $('#' + $this.data('dropdown')));
} else {
var target = $('[data-dropdown="' + $(this).attr('id') + '"]'),
settings = target.data('dropdown-init');
if (settings.is_hover) self.close.call(self, $this);
}
}.bind(this), 150);
})
jQuery를 3와 호환 그 것이다 (나는 zurb 재단 드롭 다운 플러그인에서이 코드를했다)? jQuery를으로부터의 this
에 익명 함수 내부 this
설정한다 는 http://jquery.com/upgrade-guide/3.0/#deprecated-bind-and-delegate
.bind - [documentation] (https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_objects/Function/bind) –
'this' 컨텍스트를 함수에 바인딩하므로, 이 함수 안에있는 함수는 호출되는 방식에 관계없이'bind()'에 전달되는'this'를 항상 참조합니다. – Tushar
'jquery 3와 호환 '- jQuery가 자바 스크립트 라이브러리이기 때문에 javascript의 작동 방식이 변경되지 않습니다. –