1
jQuery 대화 상자에 표시된 이미지를 동적으로 변경하려고합니다. jQuery 대화 상자에 표시된 이미지를 변경하는 데 사용할 매개 변수로 '이미지 경로'를 전달하려고합니다. 부디! 아래 내 코드를 확인하십시오. 기본적으로 jQuery 대화 상자에 'images/firstImage.jpg'가 표시됩니다. 이제 jQuery Dialog 매개 변수를 통해 'images/secondImage.jpg'로 변경하려고합니다.어떻게 jQuery Dialog에서 매개 변수를 전달하고 html의 내용을 변경할 수 있습니까?
<link href="jquery/jquery-ui.css" rel="stylesheet" />
<script src="jquery/jquery-1.10.2.js"></script>
<script src="jquery/jquery-ui.js"></script>
<script>
$(function() {
// this initializes the dialog (and uses some common options that I do)
$("#dialog").dialog(
{
autoOpen: false,
modal: true,
show: "blind",
hide: "blind",
width: "50%",
height: "auto",
resizable: false,
position: 'center',
overflow: "hidden",
});
});
function OpenGallary(photoSrc) {
$("#dialog").dialog("open").data("param", photoSrc);
}
</script>
<body>
<a onclick="OpenGallary('images/secondImage.jpg')">Click ME</a>
<div id="dialog" title="Photo Gallary">
<div id="aa" style="width: 800px;">
hello this is my world.
</div>
<p>
<img src="images/firstImage.jpg" />
</p>
</div>
</body>