0

私は通常、自分のページで「ポップアップウィンドウ」を開くためにカラーボックスツールを使用していますが、すべて問題ありません。私の新しいプロジェクトでは、handleRequestStateChange() 関数でオブジェクトを動的に作成するために js/ajax/dom を使用するため、状況は少し異なります。

カラーボックスのjs、jquery、およびcssをインポートした後、jsページの先頭に次のように記述します。

 $(document).ready(function () {
        $(window).scroll(function () {
        //oP1 = document.createTextNode(posizione_menu.offsetTop);
    //divIpt.appendChild(oMtx1);
    $(".divHcss").css("position", "fixed").css("top", "0px").css("z-index", "999");
        });
        //Examples of how to assign the Colorbox event to elements
            $(".group1").colorbox({rel:'group1'});
            $(".group2").colorbox({rel:'group2', transition:"fade"});
            $(".group3").colorbox({rel:'group3', transition:"none", width:"75%", height:"75%"});
            $(".group4").colorbox({rel:'group4', slideshow:true});
            $(".ajax").colorbox();
            $(".youtube").colorbox({iframe:true, innerWidth:640, innerHeight:390});
            $(".vimeo").colorbox({iframe:true, innerWidth:500, innerHeight:409});
            $(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});
            $(".inline").colorbox({inline:true, width:"50%"});
            $(".callbacks").colorbox({
                onOpen:function(){ alert('onOpen: colorbox is about to open'); },
                onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
                onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
                onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
                onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
            });

            $('.non-retina').colorbox({rel:'group5', transition:'none'})
            $('.retina').colorbox({rel:'group5', transition:'none', retinaImage:true, retinaUrl:true});

            //Example of preserving a JavaScript event for inline calls.
            $("#click").click(function(){ 
                $('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
                return false;
            });
    });

そして、handleRequestStateChange() の後で、要素を作成して div に割り当てます。

var a = createElement('a');
    //a.style.display = "block";
    a.setAttribute('class','iframe');
    a.setAttribute('href',"php/whois.php?P1="+oStxt.value);
    var divIp3 = createElement('div', 'divIp3', 'divIp3css');
    var divIp31 = createElement('div', 'divIp31', 'divIp31css');
    divIp3.appendChild(divIp31);
    divIp3.appendChild(a);
    a.appendChild(divIp31);

divIp31 はリンク可能になりますが、href は通常のブラウザー タブでページを開き、カラーボックスの属性クラスを使用しません。

誰かがアイデアを持っていますか?

前もって感謝します

午前

4

1 に答える 1