-4
2 개의 스크립트가 있습니다 1 개의 스크립트는 탐색 바용이고 다른 하나는 수직 스크롤을위한 것이지만 문제는 수직 스크롤링 스크립트를 삽입 할 때 nav bar 용 스크립트가 작동하지 않는다는 것입니다.하나의 페이지에 2 개의 스크립트가 있습니다
동시에 2 개의 스크립트를 작성하는 방법을 아는 사람이 있습니까?
탐색 모음 스크립트 :
<script type="text/javascript" src="js/jquery.js"></script><script type="text/javascript" src="js/jquery-easing-1.3.pack.js"></script><script type="text/javascript" src="js/jquery-easing-compatibility.1.2.pack.js"></script>
<!--[if IE]>
<style type="text/css">.jimgMenu {position:relative;width:630px;height:200px;overflow:hidden;margin-left:20px;}</style>
<![endif]-->
<script type="text/javascript">
$(document).ready(function() {
// find the elements to be eased and hook the hover event
$('div.jimgMenu ul li a').hover(function() {
// if the element is currently being animated (to a easeOut)...
if ($(this).is(':animated')) {
$(this).stop().animate({
width: "310px"
}, {
duration: 450,
easing: "easeOutQuad"
});
} else {
// ease in quickly
$(this).stop().animate({
width: "310px"
}, {
duration: 400,
easing: "easeOutQuad"
});
}
}, function() {
// on hovering out, ease the element out
if ($(this).is(':animated')) {
$(this).stop().animate({
width: "78px"
}, {
duration: 400,
easing: "easeInOutQuad"
})
} else {
// ease out slowly
$(this).stop('animated:').animate({
width: "78px"
}, {
duration: 450,
easing: "easeInOutQuad"
});
}
});
});
</script>
vertival 스크립트
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$(".contactLink").click(function() {
if ($("#contactForm").is(":hidden")) {
$("#contactForm").slideDown("slow");
} else {
$("#contactForm").slideUp("slow");
}
});
});
function closeForm() {
$("#messageSent").show("slow");
setTimeout('$("#messageSent").hide();$("#contactForm").slideUp("slow")', 2000);
}
$(document).ready(function() {
function filterPath(string) {
return string.replace(/^\//, '')
.replace(/(index|default).[a-zA-Z]{3,4}$/, '')
.replace(/\/$/, '');
}
$('a[href*=#]').each(function() {
if (filterPath(location.pathname) == filterPath(this.pathname) && location.hostname == this.hostname && this.hash.replace(/#/, '')) {
var $targetId = $(this.hash),
$targetAnchor = $('[name=' + this.hash.slice(1) + ']');
var $target = $targetId.length ? $targetId : $targetAnchor.length ? $targetAnchor : false;
if ($target) {
var targetOffset = $target.offset().top;
$(this).click(function() {
$('html, body').animate({
scrollTop: targetOffset
}, 1000);
var d = document.createElement("div");
d.style.height = "101%";
d.style.overflow = "hidden";
document.body.appendChild(d);
window.scrollTo(0, scrollToM);
setTimeout(function() {
d.parentNode.removeChild(d);
}, 10);
return false;
});
}
}
});
});
</script>
추신 : 내 탐색 모음이
두 가지 버전의 jQuery를로드 중입니다. 먼저 제거 할 수 있습니까? 그런 다음 바이올린을 만드십시오. [link] (http://jsfiddle.net) – mohkhan
2 가지 다른 위치 (그리고 적어도 2 가지 버전)에서 3 번 jQuery를 포함시키는 이유는 무엇입니까? – Kai
아니요. 2 개의 스크립트가 필요합니다. 동일한 페이지 (약 400 줄의 코드)에 HTML을 모두 프로그래밍하고 있기 때문에 사이트를 스크롤하고 다른 페이지를 연결하지 않아야하며 탐색 막대 스크립트가 필요합니다. 예, 필요합니다. ny 탐색 막대가 –