1

リンクをクリックしたときに iframe コンテンツをフェードアウトしたいのですが、方法が見つかりません。
これは動作していない私のコードです:

<object type="text/html" data="page.html" id="framecontent" width="100%" height="100%"></object>

<script type="text/javascript">
$(document).ready(function() {
    $("#mylink a").click(function(event){
        event.preventDefault();
        linkLocation = this.href;
        $("#framecontent").find("body").fadeOut('slow', redirectPage);
    });
    function redirectPage() {
        $("#framecontent").attr("data", linkLocation);
    }
});
</script>
4

2 に答える 2

0

オブジェクトを iFrame に変更し、iFrame をフェードアウトし、ページを変更し、読み込み後に iFrame をフェードインするコードを実装しました。これはあなたが探しているものですか? http://jsfiddle.net/edapU/2

<iframe src="http://www.bing.com" id="framecontent" width="100%" height="500px"></iframe>
<div id="mylink">
    <a href="http://www.bing.com">Bing</a><br/>
    <a href="http://www.car.com">Car.com</a><br/>
    <a href="http://www.microsoft.com">Microsoft</a>
</div>
<script type="text/javascript">
$(document).ready(function() {
    $("#mylink a").click(function(event){
        event.preventDefault();
        linkLocation = this.href;
        $("#framecontent").fadeOut('slow', redirectPage);
    });
    function redirectPage() {
        $("#framecontent").attr("src", linkLocation).load(function(){$(this).fadeIn('slow');});
    }
});
</script>
于 2013-02-09T19:29:59.513 に答える
0

fadeOut()動作していないようです<object>が、使用する場合<iframe>は動作するはずです。

于 2013-02-06T20:28:11.600 に答える