내가 아약스 한 페이지를 구축하고 싶지만 내가 1 파일에 내 코드가 작동하지 않기 때문에 나는 2 개의 다른 js 파일이 있습니다.아약스와 jQuery 문제
내가 어떻게 그것을 하나의 .js에서 문제가이 하나 개의 느릅 나무와
(function($) {
$.fn.visible = function(partial) {
var $t = $(this),
$w = $(window),
viewTop = $w.scrollTop(),
viewBottom = viewTop + $w.height(),
_top = $t.offset().top,
_bottom = _top + $t.height(),
compareTop = partial === true ? _bottom : _top,
compareBottom = partial === true ? _top : _bottom;
return ((compareBottom <= viewBottom) && (compareTop >= viewTop));
};
})(jQuery);
var win = $(window);
var allMods = $(".module");
// Already visible modules
allMods.each(function(i, el) {
var el = $(el);
if (el.visible(true)) {
el.addClass("already-visible");
}
});
win.scroll(function(event) {
allMods.each(function(i, el) {
var el = $(el);
if (el.visible(true)) {
el.addClass("come-in");
}
});
});
이
var win = $(window);
var allMods = $(".var");
// Already visible modules
allMods.each(function(i, el) {
var el = $(el);
if (el.visible(true)) {
el.addClass("already-visible");
}
});
win.scroll(function(event) {
allMods.each(function(i, el) {
var el = $(el);
if (el.visible(true)) {
el.addClass("come-in-var");
}
});
});
내가 그것을 어떻게 결합 할 수 있습니다 다른 페이지에 지정된 파일을하지 않는이 JS를 결합 할 수 있습니다? 감사!
결합시 어떤 오류가 있습니까? –
두 애니메이션이 작동하지 않습니다. (첫번째 작품 ... – andre34