2015-03-31 86 views
0

我想創建一個由sharepoint呈現的圖像元素彈出。我非常喜歡jquery。任何幫助是極大的讚賞。jquery對話框彈出消失

我的代碼:(.imageCss是由sharepoint呈現的圖像類)。

$(".imagecss").on("click", function() 
 
{ 
 
var dialogBox = $(document.createElement('div')); 
 
$(dialogBox).dialog(); 
 
$(dialogBox).html(this); 
 
}); 

我能夠在一個對話框顯示圖像。但是會發生什麼呢,當我點擊下一張圖片時,前一張圖片就消失了。我不確定我做錯了什麼。任何幫助不勝感激。謝謝!

回答

0

也許這樣的事情?

<html> 
 

 
<head> 
 
    <script src="/jquery-1.7.1.min.js"></script> 
 
    <script src="/jquery-ui.js"></script> 
 
    <script type="text/javascript"> 
 
    $(document).ready(function() { 
 
     $('#showImage').click(function() { 
 
     $('#imageDialog').dialog({ 
 
      modal: true 
 
     }); 
 
     }); 
 
    }); 
 
    </script> 
 
</head> 
 

 
<body> 
 

 
    <div id="imageDialog" style="display:none;"> 
 
    <img src="https://www.google.com/logos/doodles/2015/126th-anniversary-of-the-public-opening-of-the-eiffel-tower-4812727050567680-hp.jpg"> 
 
    </div> 
 
    <a id="showImage">Show images</a> \t 
 

 
</body> 
 

 
</html>