티스토리 뷰

Language/JQuery

[ JQuery ] DIV POPUP

MiniNeko 2016. 1. 2. 21:52

mini직접작성
<?

$strDateTemp = date('Y-m-d');

// 세션확인
if(session_is_registered("POPUP_ACTIVE")) {
   //echo "등록되어있습니다. : ".$_SESSION['POPUP_ACTIVE'];
} else {
   $_SESSION['POPUP_ACTIVE'] = $strDateTemp;
   echo "<script>document.location.href='/'</script>";
}

//if(!session_is_registered("POPUP_ACTIVE")) {
if(session_is_registered("POPUP_ACTIVE")) {
// 팝업 정보 시작
$STR_IMG_LIST = "";
$query = "SELECT * FROM POPUP WHERE ACTIVE = 'Y' ORDER BY RANK DESC ";
$result = mysql_query($query);
$rowNum = mysql_affected_rows();
for($pi = 0; $pi < $rowNum; $pi++) {
   $row = mysql_fetch_array($result);

   if($row[FILENAME]!="") {
      $row[FILENAME] = fileViewHandler($row[FILENAME]); // miniHandler

/*
리눅스경우 : gd library가 설치가 되어 있어서 동작을 해야해요
윈도우의 경우
1) php5>ext>php_gd2.dll 이 있는지 확인하세요~
2) 환경설정 파일 php.ini 설정
   php.ini에서 다음 소스를 수정하세요~
   ;extension=php_gd2.dll 의 주석을 다음과 같이 제거하세요~
   extension=php_gd2.dll
3) 웹서버를 다시 실행하세요~
*/
      $rowFileNameTemp = fileViewHandler($row[FILENAME]); // miniHandler
      $imgSize = getimagesize($_SERVER['DOCUMENT_ROOT']."CMS/popup/img/".$rowFileNameTemp);
      $imgWidth = $imgSize[0]; 
      $imgHeight=$imgSize[1];

      $imgWidth -= 15;
      $imgHeight -= 15;

      $strZindex1 = 100 + ($pi * 2);
      $strZindex2 = 100 + ($pi * 2) +1;

      if($row[SDATE] <= $strDateTemp && $row[EDATE] >= $strDateTemp) { // 날자 체크 시작
      $strTargetTemp = "_self";
      if($row[LINK]!="") {
         if($row[TARGET]=="B") { $strTargetTemp = "_blank"; }
         $STR_IMG_LIST .= "
         <SCRIPT>
         function popup".$strZindex1."Close() {
            $('#popup".$strZindex1."').attr('style','display:none');
         }
         </SCRIPT>
         <div id='popup".$strZindex1."' style='display:done; position:absolute; top:".$row['PTOP']."px; left:".$row['PLEFT']."px; z-index:".$strZindex1.";'>
         <div style='position:absolute; top:-15px; left:".$imgWidth."px; z-index:".$strZindex2.";'><img src='/img/closeX.png' style='cursor:pointer;' onClick='popup".$strZindex1."Close();' /></div>
         <a href='".$row[LINK]."' target='".$strTargetTemp."'><img src='/CMS/popup/img/".$row[FILENAME]."' style='box-shadow: 7px 7px 7px #666;' /></a>
         </div>
         ";
      } else {
         $STR_IMG_LIST .= "
         <div id='popup".$strZindex1."' style='display:done; position:absolute; top:".$row['PTOP']."px; left:".$row['PLEFT']."px; z-index:".$strZindex1.";'>
         <div style='position:absolute; top:-15px; left:".$imgWidth."px; z-index:".$strZindex2.";'><img src='/img/closeX.png' style='cursor:pointer;' onClick='popup".$strZindex1."Close();' /></div>
         <img src='/CMS/popup/img/".$row[FILENAME]."' style='box-shadow: 7px 7px 7px #666;' />
         </div>
         ";
      }

      echo $STR_IMG_LIST;
      } // 날자 체크 끝
   }
}

} // 세션 확인 체크

?>

=============================================================================================
=============================================================================================
=============================================================================================
// CSS
/* DIV POPUP */
#popup_area { postion:relative; width:100%; height:0px; }
#popup_area .popup_layer { position:absolute; background-color:#fff; z-index:9999; top:0%; left:5%; margin:0 auto; border:0px solid red; width:920px; }
#popup_area .close { float:right; cursor:pointer; }


// JS
$(function() {
   $('#ipop').attr('style','display:none');
   $('.close').click(function(){
      $('#ipop').attr('style','display:none');
   });
   $('.checkbox').click(function(){
      Cookier.set_cookie('cpop','true', 1);
      $('#ipop').attr('style','display:none');
   });
});

// HTML
<div id="popup_area">
   <div class="popup_layer" id="ipop">
      <div class="close"><img src="/img/closeX.png" /></div>
      <div id="dialog" style="text-align:center; border:10px solid #DDDDDD; z-index:100"></div>
   </div>
</div>







==================================================================================

<!DOCTYPE html>
<html>
<head>
<SCRIPT type="text/JavaScript" src="http://code.jquery.com/jquery-latest.min.js"></SCRIPT>
   <style type="text/css">
      #popup_area {postion:relative;width:100%;height:0px;}
      #popup_area .popup_layer {position:absolute;z-index:9999;top:5%;left:35%;margin:0 auto;border:1px solid red;width:450px;}
      #popup_area .close {float:right;cursor:pointer;}
      #popup_area .today_donot_display {height:24px; background-image:url('http://blogo.co.kr/img/popup/1302/bottom.jpg'); background-repeat:no-repeat; text-align:right;cursor:pointer;}
      #popup_area .today_donot_display .checkbox {cursor:pointer; margin-right:5px; margin-top:3px;}
   </style>
   <script type="text/javascript">
      $(function() {
         $('.close').click(function(){
            $('#ipop').attr('style','display:none');
         });
         $('.checkbox').click(function(){
            Cookier.set_cookie('cpop','true', 1);
            $('#ipop').attr('style','display:none');
         });
      });
      function divViewOpen() {
         $('#ipop').attr('style','display:done');
      }
   </script>
<body>
1111111111
   <div id="popup_area">
      <div class="popup_layer" id="ipop">
         가나다라
         <div class="close">닫기</div>
         asdfasdfasdfasdfasfasdfasdf
         asdfasdfasd
         asdfsdasdfasdfasdfasdfasdfaser qwekr;vl qkw;erk v'q;wkerpqvpweirpiqvwpe
         <div class="today_donot_display"><input type="checkbox" class="checkbox" /></div>
      </div>
   </div>
22222222222222
<input type="button" value="OPEN" onClick="divViewOpen()" />
</body>
</html>

Total
Today
Yesterday
최근에 올라온 글
«   2025/01   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31