0

asp.netWebフォームのラジオボタンonclickイベント内からShadowboxを開こうとしていますが成功しません。最初はボタンクリックを使用して開いていましたが、これは正常に機能しましたが、ラジオボタンオプションが選択されているときにそれが発生することを確認する必要があります。次に、javascript(button.click())でボタンをクリックしようとしましたが、これはIE以降のバージョンのFirefoxでのみ機能しました。そのため、Shadowbox.openを使用することを選択しましたが、いくつかの問題が発生しています。これが私のコードです:

if (yes.checked == true)
    {            
        var url = 'http://localhost:52963/items.aspx';
        Shadowbox.open( { content:    url, 
                        type:        "iframe", 
                        title:         "sbTitle ", 
                        options:   {   initialHeight:350, 
                                        initialWidth:450, 
                                        loadingImage:"loading.gif", 
                                        handleUnsupported:  'link' 
                                    } 
                     }); 
    }

これはオーバーレイを表示するように見えますが、その中のWebページは開きません。誰かが私がどこで間違っているのか知っていますか?

4

2 に答える 2

2

どうやら私はタイプだけでなくプレーヤーも追加する必要がありました。したがって、修正されたコードは次のとおりです。

Shadowbox.open( { content:    url, 
                    type:        "iframe", 
                    player:      "iframe",
                    title:         "sbTitle ", 
                    options:   {   initialHeight:350, 
                                    initialWidth:450, 
                                    loadingImage:"loading.gif", 
                                    handleUnsupported:  'link' 
                                } 
                 }); 
于 2011-07-05T08:16:44.547 に答える
1

私はこれに多くの問題を抱えていました、jqueryから.trigger('click')を使用してクリックを起動しようとしましたが、それはchromeでは機能しませんでした(firefoxで機能しました)

答えは非常に単純で、e-onの答えに似ていますが、ダイヤルダウンされていることがわかります。

あなたの画像は通常のシャドウボックスギャラリーにあります

<div class="gallery">
  <a  href="/img1.jpg" rel="shadowbox[gallery1]" >
    <img id="Image0" src="/img1.jpg" />
  </a>
  <a  href="/img2.jpg" rel="shadowbox[gallery1]" >
    <img id="Image1" src="/img2.jpg" />
  </a>
</div>

次に、クリック可能なリンク

<a href="#" class="galleryLauncher" gallery="gallery1">Click to view all images</a>

document.ready呼び出しでjqueryを介してクリック可能なリンクを配線しました

$('.galleryLauncher').click(function () {

 //gallery to launch
    var id = $(this).attr('gallery');

 //get the first item out of the cache
    var content = Shadowbox.cache[1].content;

 //default options object
    var options = {}; 

 //now we can open it
    Shadowbox.open({
        content: content,
        player: "img",
        gallery: id,
        options: options
    });

    return false;
});
于 2011-11-29T14:12:07.463 に答える