1

クリックすると、webview から画像が表示されたポップアップ ダイアログを表示しようとしています。私の問題は、ポップアップ ダイアログがポップアップされていないことですが、webview 内で全画面表示されるか、ブラウザーで開かれます。webview 内でポップアップを作成することは可能ですか? 次のWeb設定を使用しましたが、無駄でした。

WebSettings settings = wvcontent.getSettings(); 
settings.setSupportMultipleWindows(true);
settings.setPluginsEnabled(true);
settings.setAllowFileAccess(true);
settings.setJavaScriptEnabled(true); 

これは私のhtmlコンテンツです。

html_content =

"<strong>"+title+"</strong>" 
               + " <br><br><img src='"+single_image+" width='300' height='211'>" 
               + "<br> " 
               + ""+ content + "<br>"
               + str 
               + "<div id='popup' style='display:none'>"
               + "<a id='popup-close' href='' class='button'>"
               + "Fermer" 
               + "</a><p><img id='image-placeholder' width='300px';height='250px'  src=''>"

        + "<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js'></script>"
               + "<script type='text/javascript'>
                  $(document).ready( function() {
                        $('.popup-open').click( function(e)" 
               +        "{$('#popup:visible').hide(); 
                         e.preventDefault();

                 $('#image-placeholder').attr('src', $(this).attr('href'));" 
               + "$('#popup').fadeIn('fast');});
                  $('#popup-close').click( function(e) {e.preventDefault();                                                        $('#popup').fadeOut('fast');});});" 
               +"</script>";

誰かがヒントを提供できますか?

4

1 に答える 1

0

通常のポップアップ ウィンドウを使用する代わりに、モーダル ダイアログを使用してみてください。これは、アクティブなコンテンツの上にある同じページで開きます。Android では、ポップアップでやろうとしていることは不可能だと思います。それらは常に新しいウィンドウで開きます。

http://jqueryui.com/dialog/#modal

于 2012-11-22T12:59:41.830 に答える