alert 함수 대체 fancyalert 함수 추가

This commit is contained in:
chicpro
2013-10-21 17:13:38 +09:00
parent cb130df525
commit c03bfc6afc
3 changed files with 45 additions and 5 deletions

31
js/jquery.fancyalert.js Normal file
View File

@ -0,0 +1,31 @@
function fancyalert(msg)
{
var w = $(window).width();
var h = $(window).height();
var scroll_top = $(window).scrollTop();
var box;
if (/iP(hone|od|ad)/.test(navigator.platform)) {
if(window.innerHeight - $(window).outerHeight(true) > 0)
h += (window.innerHeight - $(window).outerHeight(true));
}
box = "<div id=\"fancyalert\" style=\"top:"+scroll_top+"px;width:"+w+"px;height:"+h+"px;\">";
box += "<table>";
box + "<tr>";
box += "<td width=\""+w+"\" height=\""+h+"\">"+msg;
box += "<br>";
box += "<button type=\"button\" id=\"fancyalert_close\">확인</button>";
box += "</td>";
box += "</tr>";
box += "</table>";
box += "</div>";
$("body").append(box);
}
$(function() {
$("#fancyalert_close").live("click", function() {
$("#fancyalert").fadeOut().remove();
});
});

View File

@ -4,6 +4,7 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
<link rel="stylesheet" href="<?php echo G5_MSHOP_SKIN_URL; ?>/style.css">
<script src="<?php echo G5_JS_URL; ?>/jquery.touchSwipe.min.js"></script>
<script src="<?php echo G5_JS_URL; ?>/jquery.fancyalert.js"></script>
<form name="fitem" action="<?php echo $action_url; ?>" method="post" onsubmit="return fitem_submit(this);">
<input type="hidden" name="it_id[]" value="<?php echo $it['it_id']; ?>">
@ -384,29 +385,33 @@ $(function(){
});
// 이전 다음상품 swipe
$("#container").swipe({
var swipeOptions = {
swipe: function(event, direction) {
switch(direction) {
case "left":
<?php if($next_href) { ?>
content_move(direction);
<?php } else { ?>
alert("다음 상품이 없습니다.");
fancyalert("다음 상품이 없습니다.");
<?php } ?>
break;
case "right":
<?php if($prev_href) { ?>
content_move(direction);
<?php } else { ?>
alert("이전 상품이 없습니다.");
fancyalert("이전 상품이 없습니다.");
<?php } ?>
break;
}
return false;
},
threshold: 50,
excludedElements:".noSwipe",
allowPageScroll:"vertical"
});
};
$("#container").swipe(swipeOptions);
});
function content_move(direction)

View File

@ -81,4 +81,8 @@
/* 로딩안내 레이어 */
#loading_message {position:absolute;top:0;left:0;z-index:10000;background-color:#eee;opacity:0.5}
#loading_message img {position:relative;opacity:1.0}
#loading_message img {position:relative;opacity:1.0}
/* 알림 box */
#fancyalert {position:absolute;top:0;left:0;z-index:10000;background-color:#000;opacity: 0.5}
#fancyalert td { color:#fff;text-align: center;opacity:1.0}