쪽지 알림을 설치 했는데 익스8 에서 위치가 이상해서요.
본문
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if ($member['mb_id']) {
$sql = " select count(*) as cnt from {$g4['memo_table']} where me_recv_mb_id = '{$member['mb_id']}' and me_read_datetime = '0000-00-00 00:00:00' ";
$row = sql_fetch($sql);
$memo_not_read = $row['cnt'];
}
?>
<?
if($memo_not_read > 0){ ?>
<div class="animate_layer">
<div style="height:15px; padding:7px 0 0 110px;"><img src=<?=$g4['path']?>/img/animate_close.png id="animate_close" style="cursor:pointer;"></div>
<div style="padding:10px;"><a href="javascript:win_memo_animate();">확인하지 않은 쪽지가 (<?=$memo_not_read?>)건 있습니다.</a></div>
</div>
<style>
.animate_layer a:link, .animate_layer a:visited, .animate_layer a:active { text-decoration:none; color:#ffffff; }
.animate_layer a:hover { text-decoration:underline; }
.animate_layer {
top: 0px; left: 0px; width: 130px; height: 70px; position: absolute; display:none; color:#ffffff; background-color:#666666; background: url(<?=$g4['path']?>/img/animate_bg.gif) no-repeat;
}
</style>
<script>
function win_memo_animate(url)
{
$('.animate_layer').css('display', 'none');
if (!url){
url = g4_path + "/" + g4_bbs + "/memo.php";
}
win_open(url, "winMemo", "left=50,top=50,width=620,height=460,scrollbars=1");
}
$('#animate_close').click(function(){
$('.animate_layer').css('display', 'none');
});
function animate_layer_open(){
if(window.innerWidth){
windowWidth = window.innerWidth;
}else{
if(document.documentElement && document.documentElement.clientWidth){
windowWidth = document.documentElement.clientWidth;
}else{
if(document.body){
windowWidth = document.body.offsetWidth;
}
}
}
if(window.innerHeight){
windowHeight = window.innerHeight;
}else{
if(document.documentElement && document.documentElement.clientHeight){
windowHeight=document.documentElement.clientHeight;
}else{
if(document.body){
windowHeight = document.body.clientHeight;
}
}
}
var height_tmp = jQuery("div.animate_layer").height()+30;
var windowHeight_tmp = windowHeight;
var windowWidth_tmp = windowWidth - $("div.animate_layer").width()-40;
$("div.animate_layer").css({ top:windowHeight_tmp + "px", left:windowWidth_tmp + "px"});
$("div.animate_layer").show().animate({top:"-=" + height_tmp + "px"}, 1000)
}
jQuery(document).ready(function(){
jQuery("body").animate({scrollTop:0},"slow",function(){ setTimeout(animate_layer_open,200) } )
});
</script>
<? } ?>
답변 2
어차피 jquery 쓰시는거면 이렇게 해보세요.
windowWidth = $(document).width(); // 또는 $(document).innerWidth()
windowHeight = $(document).height(); // 또는 $(document).innerHeight()
익스8까지는 같은값으로 나오네요. 다만 7이하는 지금처럼 약간 어긋날겁니다.
자바스크립트부분중에 아래 부분을 지우고 넣으시면 됩니다.
if(window.innerWidth){
windowWidth = window.innerWidth;
}else{
if(document.documentElement && document.documentElement.clientWidth){
windowWidth = document.documentElement.clientWidth;
}else{
if(document.body){
windowWidth = document.body.offsetWidth;
}
}
}
if(window.innerHeight){
windowHeight = window.innerHeight;
}else{
if(document.documentElement && document.documentElement.clientHeight){
windowHeight=document.documentElement.clientHeight;
}else{
if(document.body){
windowHeight = document.body.clientHeight;
}
}
}