저는 항상 joomla의 모듈에 jquery 스크립트를 직접 사용합니다.Joomla 3에서 javascript가 작동하지 않습니다.
요즘 Joomla2에서 Joomla3으로 전환했습니다. 여하튼 스크립트는 모듈에서 더 이상 작동하지 않습니다. 왜 그런지 압니까?
는
예 (일부 스크립트는 여전히하지만 작동) : 이 내가 일하고 것입니다.
<a href="#intro">Intro</a> <a href="#about">About</a> <a href="#info">Info</a>
<h1 id="intro">Intro</h1>
<p>abcd</p>
<h1 id="about">About</h1>
<p>xxxxxxxxxx</p>
<p>xxxxxxxxxx</p>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
var jump=function(e)
{
//prevent the "normal" behaviour which would be a "hard" jump
e.preventDefault();
//Get the target
var target = $(this).attr("href");
//perform animated scrolling
$('html,body').animate(
{
//get top-position of target-element and set it as scroll target
scrollTop: $(target).offset().top
//scrolldelay: 2 seconds
},600,function()
{
//attach the hash (#jumptarget) to the pageurl
location.hash = target;
});
}
$(document).ready(function()
{
$('a[href*=#]').bind("click", jump);
return false;
});
</script>
코드는 대상 메뉴 ID에서 부드러운 스크롤을 제공합니다. 위의 코드를 Joomla2 모듈에서 사용하면 훌륭하게 작동하지만 Joomla 3에서는 작동하지 않습니다.
아이디어가 있으십니까?
하는 브라우저 자바 스크립트 콘솔에서 모든 메시지가 표시됩니까 :
나는 여기에 코드를 다시 작성했다? 이 부분에서 오류를 찾기 시작할 수있는 좋은 장소입니다. – glenatron
콘솔에서 js 함수에서 발생한 오류를 확인 했습니까? –
자바 스크립트 콘솔을 보았습니까? 오류가있을 수 있습니다. – jedema