Jetez un coup d'oeil sur la version this
var elementClicked = $('a[href="' + text + '"]');
var destination = $(elementClicked).offset().top;
var $frame = $('#cfrench', window.parent.parent.document).contents().find('#ftoc').contents();
$frame.find("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination - 20 }, 500);
P.S. Je n'ai pas pu vérifier le code parce que je n'ai pas les détails.
version 2.0 :) (solution de travail)
main.html
<iframe id="frame1" src="page-1.htm"></iframe>
<iframe id="frame2" src="page-2.htm"></iframe>
la page-1.html
<head>
<title></title>
<style type="text/css">
#anchor { margin-top:400px; display:block; }
</style>
<script type="text/javascript" src="jquery-1.6.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#scroller').click(function() {
var $frame = $(window.parent.document).find('#frame2').contents();
var $anchor = $frame.find('#anchor');
var destination = $anchor.offset().top;
console.log(destination);
$frame.find("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination - 20 }, 500);
return false;
});
});
</script>
</head>
<body>
Page 1
<a id="scroller" href="#">Scroll iframe</a>
</body>
la page-2.html
<head>
<style type="text/css">
#anchor { margin:400px 0; display:block; }
</style>
</head>
<body>
Page 2
<a id="anchor" href="anhor.html">Anchor</a>
</body>
Merci pour les suggestions. Il ne défile toujours pas mais je vais le déboguer plus. – user823527
Checkout solution de travail – Samich
Merci beaucoup, je vais regarder cela et essayer de transférer le mécanisme à ma page. – user823527