2012-01-18 6 views
1

基本的には、リンクをクリックするとiframeで開きますが、親ページのURLはハッシュで更新されますが、iframeのURLは元のものになるように設定しようとしていますクリックされたURL(ハッシュなし)。私は、最初のクリックイベントが機能するところまで行きました。変更イベント(ユーザーがページに直接リンクしている場合)は機能しません。ここに私のコードの抜粋は次のとおりです。jquery addressとIframe

$j('.products-grid .item a, .post a').click(function(){ 
    $details.fadeIn().addClass('active'); 
    $j.address.value($j(this).attr('href').substr(2)); 
    $details.animate({left:detailGap}, { duration: 500, easing: 'easeInOutExpo'}); 
}); 

    }).change(function(event) { 
     $iframe.attr('src', event.value); 
     $details.fadeIn().addClass('active'); 
     $details.animate({left:detailGap}, { duration: 500, easing: 'easeInOutExpo'}); 
     var loadurl = location.origin + location.pathname +location.hash.substr(1); 
     alert(loadurl); 
     $iframe.attr('src', loadurl); 
    }); 

すなわち:URL、http://www.url.com/product-1(のiframe URL) のために、私はそれがhttp://www.url.com/#/product-1(ページのURL)として、これはMagentoのである を表示します。

おかげで、ロバート

答えて

0

$j('.products-grid .item li a').click(function(){ 
      $j('html, body').animate({scrollTop: '0px'}, 100); 
      $j.address.value($j(this).attr('href')); 
      $details.fadeIn().addClass('active'); 
      $j('body').addClass('open'); 
      $iframe.attr('src', 'about:blank'); 
      $details.animate({'left':detailGap - navGap}, { duration: 500, easing: 'easeInOutExpo'}); 
}); 

それを考え出したのiframeを収容され、私が作成したスライドアウトパネルが開きます。

ターゲットをiframeに設定して、その中でURLが開くようにしました。それでもディープリンクが可能です。

あなたがここに最終的な解決を見ることができます:

http://www.echodesign.com/