jQuery toggleClass example
Toggle class name on click in jQuery
by tankla
HTML
<div id="banner-message">
<!-- food_co자리에 PHP 코드를 넣으시면 되요. -->
<!-- 본 화면은 php는 지원하지 않으니까요~~~ -->
<!-- openPopup(<?php echo $food_co; ?>); -->
<button onclick="openPopup('food_co');">팝업창 띄우기</button>
</div>
CSS
body {
background: #20262E;
padding: 20px;
font-family: Helvetica;
}
#banner-message {
background: #fff;
border-radius: 4px;
padding: 20px;
font-size: 25px;
text-align: center;
transition: all 0.2s;
margin: 0 auto;
width: 300px;
}
button {
background: #0084ff;
border: none;
border-radius: 5px;
padding: 8px 14px;
font-size: 15px;
color: #fff;
}
#banner-message.alt {
background: #0084ff;
color: #fff;
margin-top: 40px;
width: 200px;
}
#banner-message.alt button {
background: #fff;
color: #000;
}
JavaScript
function openPopup(param) {
var url = "https://www.sir.kr?param="+ param;
var title = "냑이 좋아라~";
var width = 500;
var height = 500;
var top = 200;
var left = 200;
winOpen(url,title,width,height,top,left);
}
function winOpen(url,title,width,height,top,left){
window.open(url,title,"width="+width+",height="+height+",top="+top+",left="+left);
}