해결했어요~^^ - [img_gallery] 이미지 클릭시 새 창 크기 > 그누3질답

그누3질답

해결했어요~^^ - [img_gallery] 이미지 클릭시 새 창 크기 정보

그누보드 해결했어요~^^ - [img_gallery] 이미지 클릭시 새 창 크기

본문

settings에 있는 width랑 height가 창 크기군요~^^;
그래서 새로운 변수 sw와 sh를 만들어서 따로 조정해줬어요.^^

=====javascript.js=================
// 3.36
function image_window(img, w, h)
{
    var tmp_w = w;
    var tmp_h = h;

    winl = (screen.width-w)/2;
    wint = (screen.height-h)/3;

    //이미지 사이즈가 스크린보다 크면 스크롤 생성
    if (w >= screen.width | h >= screen.height) {
        scs = 'yes';
    }else {scs = 'no';}

    // 가로, 세로 창 크기 변수
    var sw = w;
    var sh = h;

    //이미지 가로가 스크린보다 크면 가로창크기 수정
    if (w >= screen.width) {
        sw = screen.width-10;
        sh = sh+16;
        winl = 0;
    }

    //이미지 세로가 스크린보다 크면 세로창크기 수정
    if (h >= screen.height) {
        sh = screen.height-80;
        sw = sw+16;
        wint = 0;
    }

    var settings  ='width='+sw+',';
        settings +='height='+sh+',';
        settings +='top='+wint+',';
        settings +='left='+winl+',';
        settings +='scrollbars='+scs+',';
        settings +='resizable=no,';
        settings +='status=no';

    win=window.open("","newWindow",settings);
    win.document.open();
    win.document.write ("<html><head><meta http-equiv='content-type' content='text/html; charset=euc-kr'>");
    win.document.write ("<title>이미지 보기</title></head>");
    win.document.write ("<body leftmargin=0 topmargin=0>");
    win.document.write ("<img src='"+img+"' width='"+w+"' height='"+h+"'border=0 onclick='window.close();' style='cursor:hand'>");
    win.document.write ("</body></html>");
    win.document.close();

    if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}

댓글 전체

전체 9,564
그누3질답 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT