브레스웹님과 zestar님의 팝업(POPUP)창 위치정해 띄우기 정보
브레스웹님과 zestar님의 팝업(POPUP)창 위치정해 띄우기본문
브레스웹님의 팝업창 게시판을 zestar님께서 여러창을 띄울수있도록
해주셨는데
팝업창 위치를 따로 정할수 없던것을
사용자가 위치를 정해서 다른곳에 띄울수있도록 했습니다
1mm정도 밀리는 부분도 수정했습니다
레이어 이동이 하나밖에 안되는것 수정하려니
허접한 저로선 힘드네요...^^
시간나는데로 해보고 되면 다시 올리겠습니다
추가한 부분은
$left_margin = array("100","500","100","500");
$ileft = $left_margin[$i];
$top_margin = array("50","50","100","100");
$itop = $top_margin[$i];
입니다
앞숫자 순서대로 창이 뜹니다
첫팝업창은 100 50인곳에 뜨고 두번째는 500 50 되는곳에 뜹니다
이후 팝업창은 다음 숫자인 곳에 뜨겠죠....^^
숫자는 팝업창 띄우고자하는 숫자로 바꿔주시면 되며
추가를 하셔도 됩니다
예 : $left_margin = array("100","500","100","500","600"","700");
$top_margin = array("50","50","100","100","300","300");
브레스웹님의
./skin/latest/popup_latest/latest.skin.php 파일을 아래 소스로 바꾸시기 바랍니다.
------------------------------------------------------------------------------------------------------------------
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
for ($i=0; $i<count($list); $i++) {
if ($i > 0)
$title = get_text($list[$i][wr_subject]);
$content = nl2br($list[$i][wr_content]);
$wr_id = "pop".$list[$i][wr_id] ;
//$ileft = $i +$i +$i +$i +$i +$i +$i +$i + 100;
//$itop = $i +$i +$i +$i +$i +$i +$i +$i + 100;
$left_margin = array("100","500","100","500");
$ileft = $left_margin[$i];
$top_margin = array("50","50","100","100");
$itop = $top_margin[$i];
$img = "$g4[path]/data/file/$bo_table/".urlencode($list[$i][file][0][file]);
if (!file_exists($img) || !$list[$i][file][0][file])
echo "";
if ($list[$i][wr_1] == "실행")
{
?>
<SCRIPT language=javascript>
<!--
clicked = false;
function startDrag<?=$wr_id?>(cx,cy) {
clicked = true;
pleft=parseInt(document.getElementById("<?=$wr_id?>").style.left);
ptop=parseInt(document.getElementById("<?=$wr_id?>").style.top);
dragxcoor=cx;
dragycoor=cy;
}
function stopDrag<?=$wr_id?>() {
clicked = false;
}
function dragBox<?=$wr_id?>(evt) {
e = evt || event;
if (clicked == true) {
newx = pleft+e.clientX-dragxcoor;
newy = ptop+e.clientY-dragycoor;
document.getElementById("<?=$wr_id?>").style.left=newx;
document.getElementById("<?=$wr_id?>").style.top=newy;
// return false;
}
}
document.onmousemove = dragBox<?=$wr_id?>;
-->
</SCRIPT>
<script language="JavaScript">
<!--
function setCookie<?=$wr_id?>( name, value, expiredays ) {
var todayDate = new Date();
todayDate.setDate( todayDate.getDate() + expiredays );
document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
function closeWin<?=$wr_id?>() {
if ( document.notice_form<?=$wr_id?>.chkbox.checked ){
setCookie<?=$wr_id?>( "<?=$wr_id?>", "done" , 1 );
}
document.all['<?=$wr_id?>'].style.visibility = "hidden";
}
//-->
</script>
<div id="<?=$wr_id?>" style="position:absolute; left:<?=$ileft?>px; top:<?=$itop?>; z-index:200; visibility:visible; display:table; cursor:move" onmousedown="startDrag<?=$wr_id?>(event.clientX,event.clientY)"
onmouseup="stopDrag<?=$wr_id?>()">
<table border='0' cellspacing='0' cellpadding='0' bgcolor="#FFFFFF">
<tr>
<td width='7'><img src='<?=$latest_skin_path?>/img/bg_01.gif' width='7' height='31'></td>
<td background='<?=$latest_skin_path?>/img/bg_04.gif'><img src='<?=$latest_skin_path?>/img/bg_02.gif' width='97' height='31'></td>
<td background='<?=$latest_skin_path?>/img/bg_04.gif'><div align='right'><img src='<?=$latest_skin_path?>/img/bg_06.gif' width='114' height='31'></div></td>
<td width='7'><img src='<?=$latest_skin_path?>/img/bg_07.gif' width='7' height='31'></td>
</tr>
<tr>
<td background='<?=$latest_skin_path?>/img/bg_22.gif'><img src='<?=$latest_skin_path?>/img/bg_22.gif' width='7' height='1'></td>
<td colspan='2' valign='top'>
<?
if ($list[$i][file][0][file])
{
echo "<a href={$list[$i][wr_link1]} target={$list[$i][wr_2]}><img src='{$img}' border='0'></a>";
}
else
{
echo "<table width='367' border='0' cellspacing='0' cellpadding='0'>";
echo "<tr>";
echo "<td width='23'><img src='{$latest_skin_path}/img/bg_09.gif' width='23' height='27'></td>";
echo "<td width='320' background='{$latest_skin_path}/img/bg_11.gif'><div align='center'><img src='{$latest_skin_path}/img/bg_11.gif' width='1' height='27'></div></td>";
echo "<td width='24'><img src='{$latest_skin_path}/img/bg_13.gif' width='24' height='27'></td>";
echo "</tr>";
echo "<tr>";
echo "<td background='{$latest_skin_path}/img/bg_23.gif'><img src='{$latest_skin_path}/img/bg_23.gif' width='23' height='1'></td>";
echo "<td valign='top'>";
echo "<table width=100% border=0 cellspacing=0 cellpadding=0 align=center>";
echo "<tr><td height=25><font color=#416B01>♣ <b>{$list[$i][wr_subject]}</b></font></td><td align=right>{$list[$i][datetime]}</td></tr>";
echo "<tr><td height=1 colspan=2 bgcolor=#cccccc></td></tr>";
echo "<tr><td height=2 colspan=2 bgcolor=#efefef></td></tr>";
echo "<td valign=top colspan=2 style=padding-top:10px;>{$content}</td>";
echo "</tr>";
echo "</table>";
echo "</td>";
echo "<td background='{$latest_skin_path}/img/bg_19.gif'><img src='{$latest_skin_path}/img/bg_19.gif' width='24' height='8'></td>";
echo "</tr>";
echo "<tr>";
echo "<td><img src='{$latest_skin_path}/img/bg_26.gif' width='23' height='66'></td>";
echo "<td background='{$latest_skin_path}/img/bg_28.gif'><img src='{$latest_skin_path}/img/bg_27.gif' width='320' height='66'></td>";
echo "<td><img src='{$latest_skin_path}/img/bg_29.gif' width='24' height='66'></td>";
echo "</tr>";
echo "</table>";
}
?>
</td>
<td background='<?=$latest_skin_path?>/img/bg_18.gif'><img src='<?=$latest_skin_path?>/img/bg_18.gif' width='7' height='1'></td>
</tr>
<tr>
<td><img src='<?=$latest_skin_path?>/img/bg_30.gif' width='7' height='31'></td>
<td colspan='2' background='<?=$latest_skin_path?>/img/bg_32.gif'>
<form name="notice_form<?=$wr_id?>">
<table width='256' border='0' cellspacing='0' cellpadding='0' align='right'>
<tr>
<td width="20"><a href="#"><input type="checkbox" name="chkbox" value="checkbox" onclick="closeWin<?=$wr_id?>();"></a></td>
<td width="167">24시간 동안 이창을 열지않음</td>
<td width="67"><a href="javascript:closeWin<?=$wr_id?>();"><img src='<?=$latest_skin_path?>/img/bg_34.gif' width='67' height='31' align='absmiddle' border='0'></a></td>
</tr>
</table>
</form>
</td>
<td><img src='<?=$latest_skin_path?>/img/bg_35.gif' width='7' height='31'></td>
</tr>
</table>
</div>
<script language="Javascript">
cookiedata = document.cookie;
if ( cookiedata.indexOf("<?=$wr_id?>=done") < 0 ){
document.all['<?=$wr_id?>'].style.visibility = "visible";
}
else {
document.all['<?=$wr_id?>'].style.visibility = "hidden";
}
</script>
<?
}
?>
<?
}
?>
해주셨는데
팝업창 위치를 따로 정할수 없던것을
사용자가 위치를 정해서 다른곳에 띄울수있도록 했습니다
1mm정도 밀리는 부분도 수정했습니다
레이어 이동이 하나밖에 안되는것 수정하려니
허접한 저로선 힘드네요...^^
시간나는데로 해보고 되면 다시 올리겠습니다
추가한 부분은
$left_margin = array("100","500","100","500");
$ileft = $left_margin[$i];
$top_margin = array("50","50","100","100");
$itop = $top_margin[$i];
입니다
앞숫자 순서대로 창이 뜹니다
첫팝업창은 100 50인곳에 뜨고 두번째는 500 50 되는곳에 뜹니다
이후 팝업창은 다음 숫자인 곳에 뜨겠죠....^^
숫자는 팝업창 띄우고자하는 숫자로 바꿔주시면 되며
추가를 하셔도 됩니다
예 : $left_margin = array("100","500","100","500","600"","700");
$top_margin = array("50","50","100","100","300","300");
브레스웹님의
./skin/latest/popup_latest/latest.skin.php 파일을 아래 소스로 바꾸시기 바랍니다.
------------------------------------------------------------------------------------------------------------------
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
for ($i=0; $i<count($list); $i++) {
if ($i > 0)
$title = get_text($list[$i][wr_subject]);
$content = nl2br($list[$i][wr_content]);
$wr_id = "pop".$list[$i][wr_id] ;
//$ileft = $i +$i +$i +$i +$i +$i +$i +$i + 100;
//$itop = $i +$i +$i +$i +$i +$i +$i +$i + 100;
$left_margin = array("100","500","100","500");
$ileft = $left_margin[$i];
$top_margin = array("50","50","100","100");
$itop = $top_margin[$i];
$img = "$g4[path]/data/file/$bo_table/".urlencode($list[$i][file][0][file]);
if (!file_exists($img) || !$list[$i][file][0][file])
echo "";
if ($list[$i][wr_1] == "실행")
{
?>
<SCRIPT language=javascript>
<!--
clicked = false;
function startDrag<?=$wr_id?>(cx,cy) {
clicked = true;
pleft=parseInt(document.getElementById("<?=$wr_id?>").style.left);
ptop=parseInt(document.getElementById("<?=$wr_id?>").style.top);
dragxcoor=cx;
dragycoor=cy;
}
function stopDrag<?=$wr_id?>() {
clicked = false;
}
function dragBox<?=$wr_id?>(evt) {
e = evt || event;
if (clicked == true) {
newx = pleft+e.clientX-dragxcoor;
newy = ptop+e.clientY-dragycoor;
document.getElementById("<?=$wr_id?>").style.left=newx;
document.getElementById("<?=$wr_id?>").style.top=newy;
// return false;
}
}
document.onmousemove = dragBox<?=$wr_id?>;
-->
</SCRIPT>
<script language="JavaScript">
<!--
function setCookie<?=$wr_id?>( name, value, expiredays ) {
var todayDate = new Date();
todayDate.setDate( todayDate.getDate() + expiredays );
document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
function closeWin<?=$wr_id?>() {
if ( document.notice_form<?=$wr_id?>.chkbox.checked ){
setCookie<?=$wr_id?>( "<?=$wr_id?>", "done" , 1 );
}
document.all['<?=$wr_id?>'].style.visibility = "hidden";
}
//-->
</script>
<div id="<?=$wr_id?>" style="position:absolute; left:<?=$ileft?>px; top:<?=$itop?>; z-index:200; visibility:visible; display:table; cursor:move" onmousedown="startDrag<?=$wr_id?>(event.clientX,event.clientY)"
onmouseup="stopDrag<?=$wr_id?>()">
<table border='0' cellspacing='0' cellpadding='0' bgcolor="#FFFFFF">
<tr>
<td width='7'><img src='<?=$latest_skin_path?>/img/bg_01.gif' width='7' height='31'></td>
<td background='<?=$latest_skin_path?>/img/bg_04.gif'><img src='<?=$latest_skin_path?>/img/bg_02.gif' width='97' height='31'></td>
<td background='<?=$latest_skin_path?>/img/bg_04.gif'><div align='right'><img src='<?=$latest_skin_path?>/img/bg_06.gif' width='114' height='31'></div></td>
<td width='7'><img src='<?=$latest_skin_path?>/img/bg_07.gif' width='7' height='31'></td>
</tr>
<tr>
<td background='<?=$latest_skin_path?>/img/bg_22.gif'><img src='<?=$latest_skin_path?>/img/bg_22.gif' width='7' height='1'></td>
<td colspan='2' valign='top'>
<?
if ($list[$i][file][0][file])
{
echo "<a href={$list[$i][wr_link1]} target={$list[$i][wr_2]}><img src='{$img}' border='0'></a>";
}
else
{
echo "<table width='367' border='0' cellspacing='0' cellpadding='0'>";
echo "<tr>";
echo "<td width='23'><img src='{$latest_skin_path}/img/bg_09.gif' width='23' height='27'></td>";
echo "<td width='320' background='{$latest_skin_path}/img/bg_11.gif'><div align='center'><img src='{$latest_skin_path}/img/bg_11.gif' width='1' height='27'></div></td>";
echo "<td width='24'><img src='{$latest_skin_path}/img/bg_13.gif' width='24' height='27'></td>";
echo "</tr>";
echo "<tr>";
echo "<td background='{$latest_skin_path}/img/bg_23.gif'><img src='{$latest_skin_path}/img/bg_23.gif' width='23' height='1'></td>";
echo "<td valign='top'>";
echo "<table width=100% border=0 cellspacing=0 cellpadding=0 align=center>";
echo "<tr><td height=25><font color=#416B01>♣ <b>{$list[$i][wr_subject]}</b></font></td><td align=right>{$list[$i][datetime]}</td></tr>";
echo "<tr><td height=1 colspan=2 bgcolor=#cccccc></td></tr>";
echo "<tr><td height=2 colspan=2 bgcolor=#efefef></td></tr>";
echo "<td valign=top colspan=2 style=padding-top:10px;>{$content}</td>";
echo "</tr>";
echo "</table>";
echo "</td>";
echo "<td background='{$latest_skin_path}/img/bg_19.gif'><img src='{$latest_skin_path}/img/bg_19.gif' width='24' height='8'></td>";
echo "</tr>";
echo "<tr>";
echo "<td><img src='{$latest_skin_path}/img/bg_26.gif' width='23' height='66'></td>";
echo "<td background='{$latest_skin_path}/img/bg_28.gif'><img src='{$latest_skin_path}/img/bg_27.gif' width='320' height='66'></td>";
echo "<td><img src='{$latest_skin_path}/img/bg_29.gif' width='24' height='66'></td>";
echo "</tr>";
echo "</table>";
}
?>
</td>
<td background='<?=$latest_skin_path?>/img/bg_18.gif'><img src='<?=$latest_skin_path?>/img/bg_18.gif' width='7' height='1'></td>
</tr>
<tr>
<td><img src='<?=$latest_skin_path?>/img/bg_30.gif' width='7' height='31'></td>
<td colspan='2' background='<?=$latest_skin_path?>/img/bg_32.gif'>
<form name="notice_form<?=$wr_id?>">
<table width='256' border='0' cellspacing='0' cellpadding='0' align='right'>
<tr>
<td width="20"><a href="#"><input type="checkbox" name="chkbox" value="checkbox" onclick="closeWin<?=$wr_id?>();"></a></td>
<td width="167">24시간 동안 이창을 열지않음</td>
<td width="67"><a href="javascript:closeWin<?=$wr_id?>();"><img src='<?=$latest_skin_path?>/img/bg_34.gif' width='67' height='31' align='absmiddle' border='0'></a></td>
</tr>
</table>
</form>
</td>
<td><img src='<?=$latest_skin_path?>/img/bg_35.gif' width='7' height='31'></td>
</tr>
</table>
</div>
<script language="Javascript">
cookiedata = document.cookie;
if ( cookiedata.indexOf("<?=$wr_id?>=done") < 0 ){
document.all['<?=$wr_id?>'].style.visibility = "visible";
}
else {
document.all['<?=$wr_id?>'].style.visibility = "hidden";
}
</script>
<?
}
?>
<?
}
?>
추천
0
0
댓글 6개

감사합니다~ 잘쓰겠슴돵 ( _ _ )
정리해 주셔서 감사합니다 ^^
감사합니다. 스크랩하겠습니다.
좋은 팁입니다. 감사합니다. 스크랩...
쉽게 팝업의 위치를 변경할수 있겠네요.
좋은 정보 감사합니다...