롤링되는 배너인데 클릭하면 새창으로 열리게 하려면 어떻게 해야하나요?
본문
쇼핑몰에서 배너를 롤링되게 만들었는데
배너를 클릭하면 현재창으로 뜨고 있습니다. 이것을 클릭하면 새창으로 뜨게 하는 방법을 모르겠네요... ㅠ ㅠ
도움 좀 부탁 드립니다....
아래 소스에서 어디를 건드려야할지를 모르겠네요....
================================================================================================
<table width="550" height="320" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<!--메인배너 링크변경 시작-->
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
$(function() {
$('#ilgan_main_banner #ilgan_main_banner1').click(function(){
location.href = '/front/php/product.php?product_no=4754&main_cate_no=&display_group=';
});
$('#ilgan_main_banner #ilgan_main_banner2').click(function(){
location.href = '/front/php/product.php?product_no=4606&main_cate_no=&display_group=';
});
$('#ilgan_main_banner #ilgan_main_banner3').click(function(){
location.href = '/front/php/product.php?product_no=4534&main_cate_no=&display_group=';
});
$('#ilgan_main_banner #ilgan_main_banner4').click(function(){
location.href = '/front/php/product.php?product_no=5254&main_cate_no=&display_group=';
});
<!--메인배너 링크변경 끝-->
var old_ban_img='1';
var banb = 1;
var interval_banbest;
setInterval_banbest();
function setInterval_banbest(){
interval_banbest = setInterval(function(){ banbest_change(); },3000);
}
function banbest_change(){
if( banb == 4 ) banb = 1;
else banb++;
Comeon3(banb);
}
function Comeon3(banb){
$('#ilgan_main_banner #ilgan_main_banner'+old_ban_img).css('display', 'none');
$('#ilgan_main_banner #ilgan_main_banner'+banb).css('display', '');
old_ban_img=banb;
}
});
</script>
<div id="ilgan_main_banner" style="width: 550px; height: 320px; overflow: hidden;">
<div id="ilgan_main_banner1" style="width: 550px; height: 320px; background: url(/web/upload/img/main_banner/banner1.jpg) no-repeat; cursor: pointer; "></div>
<div id="ilgan_main_banner2" style="width: 550px; height: 320px; background: url(/web/upload/img/main_banner/banner2.jpg) no-repeat; display: none; cursor: pointer; "></div>
<div id="ilgan_main_banner3" style="width: 550px; height: 320px; background: url(/web/upload/img/main_banner/banner3.jpg) no-repeat; display: none; cursor: pointer; "></div>
<div id="ilgan_main_banner4" style="width: 550px; height: 320px; background: url(/web/upload/img/main_banner/banner4.jpg) no-repeat; display: none; cursor: pointer; "></div>
</div>
</td></tr></table>
답변 2
예를 들면
location.href = '/front/php/product.php?product_no=4754&main_cate_no=&display_group='; 이런 경우를
window.open('/front/php/product.php?product_no=4754&main_cate_no=&display_group=');
이런 식으로 모두 바꾸시면 될 것 같습니다 ^^
$(function() {
var openNewWindow = window.open("about:blank");
$('#ilgan_main_banner #ilgan_main_banner1').click(function(){
openNewWindow.location.href = '/front/php/product.php?product_no=4754&main_cate_no=&display_group=';
});
$('#ilgan_main_banner #ilgan_main_banner2').click(function(){
openNewWindow.location.href = '/front/php/product.php?product_no=4606&main_cate_no=&display_group=';
});
$('#ilgan_main_banner #ilgan_main_banner3').click(function(){
openNewWindow.location.href = '/front/php/product.php?product_no=4534&main_cate_no=&display_group=';
});
$('#ilgan_main_banner #ilgan_main_banner4').click(function(){
openNewWindow.location.href = '/front/php/product.php?product_no=5254&main_cate_no=&display_group=';
});