모바일에서 하위 iframe에서 부모페이지의 width 값을 가져올 때, 실제 width값을 가져오지 못하는 오류가 있다. Chrome에서 개발자 모드로 iframeScreenWidth
와 parentScreenWidth
를 체크하면 값이 같게 나온다. 하지만, 실제 아이폰에서 alert를 띄어 두 값을 체크하면 다르게 나온다. 그래서 실제 부모 페이지의 width값을 가져오려면 window.innerWidth
를 보다는 $(top.document).width()
로 작성해야 한다. 기본적으로 모바일에서는 iframe 사용을 자제해야 한다.
var $container = $("#iframe").contents().find("#container");
var $table = $container.find("table") || null;
var iframeScreenWidth = window.innerWidth || 0;
var parentScreenWidth = $(top.document).width() || 0;
var scaleRatio = 1;
if ($table.length) {
// scaleRatio = iframeScreenWidth / parseInt($table.width(), 10);
scaleRatio = parentScreenWidth / parseInt($table.width(), 10);
$table.css({
'transform': 'scale(' + scaleRatio + ') translate3d(0, 0, 0)',
'transform-origin': '0 0',
'-webkit-transform': 'scale(' + scaleRatio + ') translate3d(0, 0, 0)',
'-webkit-transform-origin': '0 0',
});
}
sticky 내비게이션은 스크롤시 페이지 상단에 고정되는 내비게이션이다. css의 postition:sticky 속성을 이용해 간단히 해당 내비게이션을 만들 수 있다. IE는 지원하지 않으며, Edge 16+, Firefox 32+, Chrome 56+ 지원한다. ~js const agent = navigator.userAgent.toLowerCase()...
Maven이나 gradle에 추가를 해도 안 될때, Eclipse Java 프로젝트 오른쪽 마우스 메뉴에서 Build Path Configure Build Path 메뉴나 Properties Java Build Path 메뉴에서 Libraries 탭에서 Add External JARs 버튼을 클릭하여 [$톰캣홈] lib 에서 servlet-api.ja...
sqlplus로 접속후 create user 계정이름 identified by 비밀번호; 하면 계정이 생성되었으나, Oracle 12c로 넘어가면서 오류가 생긴다. 해결 방법은 계정이름 앞에 c를 붙여야 공통 사용자를 생성 가능하다. ~shell SQL create user cscott identified by tiger; // user 생성 ...
모바일에서 하위 iframe에서 부모페이지의 width 값을 가져올 때, 실제 width값을 가져오지 못하는 오류가 있다. Chrome에서 개발자 모드로 iframeScreenWidth와 parentScreenWidth를 체크하면 값이 같게 나온다. 하지만, 실제 아이폰에서 alert를 띄어 두 값을 체크하면 다르게 나온다. 그래서 실제 부모 페이지의 wi...