[JSP] 조건부 모달 열기, 모달 전용 이벤트 핸들러, bootstarp modal, spring framework model and view
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 | <!doctype html> <html lang="en"> <head> <script> // 클래스 속성 변경에 따라 Modal 열기 // spring framework에서 ModelandView로 데이터를 넘겨 // 페이지 로딩 시점에 모달을 조건에 따라 열리게 함 $(document).ready(function() { if($("#loginMenuId").length > 0){ // 존재 한다면, null 체크 var vActive = $("#loginMenuId").attr("class"); if (vActive.indexOf("active") == -1) { $("#loginModal").modal("show"); } } }); // 모달 전용 이벤트 $(document).on('shown.bs.modal', '#loginModal', function () { // do somedoing }); </script> </head> <c:set var="nav"> <tiles:getAsString name="nav" /> </c:set> <body> <h1>Hello, world!</h1> <li id="loginMenuId" class="${nav eq 5?'active':'' }"> <a data-backdrop="static" data-toggle="modal" data-target="#loginModal"> 로그인 </a> </li> </body> </html> |
댓글
댓글 쓰기