2014-08-31 8 views
0

this 페이지 애니메이션 작업 중입니다. 아래 코드와 같이 각 페이지 요소에 iframe을 포함 시켰습니다.Iframe에서 Jquery 애니메이션 트리거링

<div class="pt-page pt-page-3">3 
     <button class="pt-trigger" data-animation="50" data-goto="-1">Go to next page</button> 
     <iframe src="file:///E:/Tech%20Nidarshan/Events%20Page/index2.html" style="position:fixed; top:0px; left:0px; bottom:0px; right:0px; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:150;" ></iframe> 
    </div> 
    <div class="pt-page pt-page-4">4 
     <button class="pt-trigger" data-animation="50" data-goto="-1">Go to next page</button> 
    </div> 
    <div class="pt-page pt-page-5">5 
     <button class="pt-trigger" data-animation="50" data-goto="-1">Go to next page</button> 
    </div> 

이 태그는 페이지 전환을 트리거합니다. iframe 내부에서 전환을 트리거 할 수 있습니까?

답변

0

애니메이션이 iframe 내부에 정의 된 함수라고 가정 해 보겠습니다. 때문에 동일 출처 정책에 크롬,이 로컬 파일에 작동하지 않을 수 있습니다 :

window.myIframe.myFunction(); 

참고 : 외부에서 호출하려면 그런 식으로 (즉, name="myIframe"을) 당신은 iframe에 name 속성을주고 함수를 호출 할 수 규칙. 서버 또는 파이어 폭스를 사용하는 경우 문제가 없어야합니다.

+0

답변 해 주셔서 감사합니다. 하지만 내 애니메이션 함수는 iframe 외부에 있으며 iframe에서 호출하려고합니다. 할 수 있습니까? –

+0

@beingkvn window.parent.myFunction();을 호출 해보십시오. 안에서부터. – blex

+0

내가 제공 한 링크를 확인하십시오. "데이터 애니메이션"값에 액세스하는 JS 파일이 있습니다. iframe에 해당 데이터 애니메이션이 포함되어 있다면 어떻게 액세스 할 수 있습니까? 나는 이것을 시도> http://stackoverflow.com/questions/7015441/get-the-contents-of-a-class-inside-an-iframe-with-greasemonkey –

관련 문제