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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | --------------------------------------------■ 제이쿼리----------------------------------------------------------------------- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> --------------------------------------------■ 소스코드 정리------------------------------------------------------------------------- http : // tools.arantius.com/tabifier --------------------------------------------■ 캐릭터셋--------------------------------------------------------------------- echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'; --------------------------------------------■ idx 찾기--------------------------------------------------------------------- var $item = $('.item').on('click', function() { var idx = $item.index(this); console.log(idx); }); ------------------------------------------■ 객체내용보기------------------------------------------------------------------------------------------------ var txt = ""; var obj = this; for (var x in obj) { txt += [ x, obj[x] ] + "<br><br>"; } $("#rs").append(txt); -----------------------------------------■ 폼값 가져오기------------------------------------------------- $("form[name='frm1']").serialize(); -------------------------■ 아이프레임 리사이즈1------------------------- <iframe id = "iframe2" src = "iframe_list.php?m_idx=2&page=1" marginWidth = 0 marginHeight = 0 frameBorder = 0 width = "100%" height = "100%" scrolling = no onload = "iFrameInit('iframe2');"></iframe> <script> var iframe_id = ''; function iFrameInit(id) { iframe_id = id; var html = $("#" + id) .contents() .find('body')[0] .innerHTML; $("#vira").html(html); $("#vira").hide(); setTimeout("setIframeHeight()", 500); } function setIframeHeight() { $("#" + iframe_id).height($("#vira").height() + 70); } </script> -----------------------------■ 아이프레임 리사이즈2----------------------------------------------------------- <div id="vira" style="z-index:98;top:0px;left:0px;position:absolute;"> <div> <!-- 아이프레임 리사이즈 --> <iframe id="iframe" src="<?=$_SERVER[">http://<?=$_SERVER['HTTP_HOST']?>/gnu/bbs/board.php?bo_table=notice" marginWidth=0 marginHeight=0 frameBorder=0 width="100%" height="100%" scrolling=no onload="iFrameInit('iframe');"></iframe> </div> </div> <script> var iframe_id = ''; function iFrameInit(id) { iframe_id = id; var html = $("#"+id).contents().find('body')[0].innerHTML; var h = $("#"+id).contents().find('body')[0].scrollHeight; $("#"+iframe_id).height(h+70); } </script> -------------------------------------■ 체크박스 전부체크------------------------------------------------------- function allCheck(name) { $.each($("input[name='"+name+"']"), function(i) { if(this.checked) { this.checked = false; } else { this.checked = true; } }); } -------------------------------------■ jquery ajax------------------------------------------------------- $.ajax({ type: "POST", url: "" , dataType: "text", data: "", success: function(msg) { alert(msg); }, error: function(msg) { alert(msg.responseText); } }); -----------------------------------■ 앱솔루트 레이어---------------------------------------------------------- <div style='width:100px;height:100px;z-index:98;top:200px;left:0px;position:absolute;background:#FFFFFF;border:1px solid;'>aaa</div> -----------------------------------■ 테이블 border 겹치지 않게---------------------------------------- style=" border-collapse:collapse;width:100%;" ------------------------------------■ 팝업 세팅------------------------------------------------------ ■ 팝업 세팅 absolute 속성 left:50%; top:50% margin-left:- 팝업넓이 반값 margin-top:- 팝업높이 반값 -----------------------------------■ 글자 블록 넘어갈때----------------------------------------------------------- table -> style="table-layout:fixed;" td-> style="word-break:break-all;" 글자 블록 넘어갈때 -----------------------------------■ 글자 블록 안넘기기---------------------------------------------------- <style> .strcut{ text - overflow : ellipsis; white - space : nowrap; overflow : hidden; } </style> -------------------------------■ 전체메뉴 슬라이드--------------------------------------------------------- //전체메뉴 슬라이드 $("#gnb>ul").hover(function(){ $("#drop_down").css("height", drop_height); $("#drop_down").stop().slideDown(200); },function() { $("#drop_down").css("height", drop_height); $("#drop_down").stop().slideUp(200); }); $("#drop_down").hover(function(){ $("#drop_down").css("height", drop_height); $("#drop_down").stop().slideDown(200); },function(){ $("#drop_down").css("height", drop_height); $("#drop_down").stop().slideUp(200); }); $("dd").hover(function(){ $(this).css("background", "red"); $(this.children[0]).css("color", "#ffffff"); $(this.children[0]).css("font-weight", "bold"); },function() { $(this).css("background", ""); $(this.children[0]).css("color", ""); }); ------------------------------■ 브라우져 버젼 알아내기-------------------------------------------------------------- //브라우져 버전 알아내기 var agent = navigator.userAgent.toLowerCase(); if((navigator.appName == 'Netscape' && navigator.userAgent.search('Trident') != -1)) { $("#bb").html("인터넷 익스플로러 브라우저 입니다. 11"); alert("인터넷 익스플로러 브라우저 입니다. 11"); } else if(agent.indexOf("msie") != -1) { $("#bb").html("인터넷 익스플로러 브라우저 입니다. 10 이하"); alert("인터넷 익스플로러 브라우저 입니다. 11"); } else { alert("인터넷 익스플로러 브라우저가 아닙니다."); } ------------------------------------------------------------------------------------------------------ | cs |
'Jquery' 카테고리의 다른 글
자바스크립트 복사하기 만들기 (0) | 2020.11.18 |
---|