서브페이지에 스와이퍼나 슬릭을 넣을 수 있나요?
본문
안녕하세요, 서브페이지를 랜딩페이지로 만들어야해서 스와이퍼나 슬릭을 쓰려고하는데
스와이퍼나 슬릭이나 작동을 안합니다.. 보여지는 페이지인 view.skin.php에 script를 넣었습니다.
혹시 여기에 스크립트를 넣으면 안되는걸까요..?
답변 5
해당에 정상적으로 스크립트를 넣고하셨다면 작동을 합니다. 개발자 도구로 스크립트 에러가 있는지 확인을 해보셔야 할거 같습니다.
게시판 상세페이지인가보군요
다 작동합니다.
코드를 올리시면 답변이 달릴거에요~
f12 누르셔서 콘솔탭에 선행 오류 있는지 확인해보시구요
정말 왜 안되는지 알고 싶으시면 어떻게 어느곳에 넣었는지 상세 설명이 필요합니다.
일단 스와이퍼 html 코드는 본문 입력창에 html 입력 모드로 올렸습니다.
콘솔 확인 결과 스크립트 오류는 딱히 없었습니다...
하단은 view.skin.php 코드 전문입니다.
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once(G5_LIB_PATH.'/thumbnail.lib.php');
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0);
?>
<script src="<?php echo G5_JS_URL; ?>/viewimageresize.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@10/swiper-bundle.min.css"/>
<script defer src="https://cdn.jsdelivr.net/npm/swiper@10/swiper-bundle.min.js"></script>
<div class="page_wr ">
<div class="page_tit page-start">
(페이지 제목)
</div>
<article id="bo_v" style="width:<?php echo $width; ?>; margin: 0 auto;">
<section id="bo_v_atc">
<h2 id="bo_v_atc_title">본문</h2>
<?php
// 파일 출력
$v_img_count = count($view['file']);
if($v_img_count) {
echo "<div id=\"bo_v_img\">\n";
for ($i=0; $i<=count($view['file']); $i++) {
if ($view['file'][$i]['view']) {
//echo $view['file'][$i]['view'];
echo get_view_thumbnail($view['file'][$i]['view']);
}
}
echo "</div>\n";
}
?>
<div id="bo_v_con"><?php echo get_view_thumbnail($view['content']); ?></div>
<? if ($view['wr_5']) echo $view['wr_5']; ?>
<?php if ($is_signature) { ?><p><?php echo $signature ?></p><?php } ?>
</section>
<!-- 게시물 하단 버튼 시작 { -->
<div id="bo_v_top">
<?php
ob_start();
?>
<ul class="bo_v_left">
<?php if ($update_href) { ?><li><a href="<?php echo $update_href ?>" class="btn_b01 btn"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> 수정</a></li><?php } ?>
<?php if ($delete_href) { ?><li><a href="<?php echo $delete_href ?>" class="btn_b01 btn" onclick="del(this.href); return false;"><i class="fa fa-trash-o" aria-hidden="true"></i> 삭제</a></li><?php } ?>
<?php if ($copy_href) { ?><li><a href="<?php echo $copy_href ?>" class="btn_admin btn" onclick="board_move(this.href); return false;"><i class="fa fa-files-o" aria-hidden="true"></i> 복사</a></li><?php } ?>
<?php if ($move_href) { ?><li><a href="<?php echo $move_href ?>" class="btn_admin btn" onclick="board_move(this.href); return false;"><i class="fa fa-arrows" aria-hidden="true"></i> 이동</a></li><?php } ?>
<?php if ($search_href) { ?><li><a href="<?php echo $search_href ?>" class="btn_b01 btn"><i class="fa fa-search" aria-hidden="true"></i> 검색</a></li><?php } ?>
</ul>
<ul class="bo_v_com">
<li>
<? if ($member['mb_level'] >= 10 ) { ?>
<a href="<?php echo $list_href ?>" class="btn_b01 btn"><i class="fa fa-list" aria-hidden="true"></i> 목록</a>
<? } ?>
</li>
<?php if ($reply_href) { ?><li><a href="<?php echo $reply_href ?>" class="btn_b01 btn"><i class="fa fa-reply" aria-hidden="true"></i> 답변</a></li><?php } ?>
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn_b02 btn"><i class="fa fa-pencil" aria-hidden="true"></i> 글쓰기</a></li><?php } ?>
</ul>
<!--
<?php if ($prev_href || $next_href) { ?>
<ul class="bo_v_nb">
<?php if ($prev_href) { ?><li class="btn_prv"><span class="nb_tit"><i class="fa fa-caret-up" aria-hidden="true"></i> 이전글</span><a href="<?php echo $prev_href ?>">이전글제목입니다.</a> <span class="nb_date">17.07.14</span></li><?php } ?>
<?php if ($next_href) { ?><li class="btn_next"><span class="nb_tit"><i class="fa fa-caret-down" aria-hidden="true"></i> 다음글</span><a href="<?php echo $next_href ?>">다음글제목입니다.</a> <span class="nb_date">17.07.14</span></li><?php } ?>
</ul>
<?php } ?>
<?php
$link_buttons = ob_get_contents();
ob_end_flush();
?>
-->
</div>
</article>
<!-- 게시글 보기 끝 -->
<script>
$(function() {
$("a.view_image").click(function() {
window.open(this.href, "large_image", "location=yes,links=no,toolbar=no,top=10,left=10,width=10,height=10,resizable=yes,scrollbars=no,status=no");
return false;
});
// 추천, 비추천
$("#good_button, #nogood_button").click(function() {
var $tx;
if(this.id == "good_button")
$tx = $("#bo_v_act_good");
else
$tx = $("#bo_v_act_nogood");
excute_good(this.href, $(this), $tx);
return false;
});
// 이미지 리사이즈
$("#bo_v_atc").viewimageresize();
});
function excute_good(href, $el, $tx)
{
$.post(
href,
{ js: "on" },
function(data) {
if(data.error) {
alert(data.error);
return false;
}
if(data.count) {
$el.find("strong").text(number_format(String(data.count)));
if($tx.attr("id").search("nogood") > -1) {
$tx.text("이 글을 비추천하셨습니다.");
$tx.fadeIn(200).delay(2500).fadeOut(200);
} else {
$tx.text("이 글을 추천하셨습니다.");
$tx.fadeIn(200).delay(2500).fadeOut(200);
}
}
}, "json"
);
}
스마트에디터 새창 버그 수정
jQuery("#bo_v_atc a").each(function ()
{
if (jQuery(this).attr("target") == "_self")
return;
else if (jQuery(this).attr("target") !== "_self")
{jQuery(this).attr("target", "_blank");}
})
</script>
<!-- tab 스크립트 -->
<script>
$('.tab_wrap > .tab_head > li').click(function(){
var $this = $(this);
var tabIndex = $this.index();
var $tabContents = $this.parents().siblings('.tab_contents');
$this.siblings('.active').removeClass('active');
$this.addClass('active');
$tabContents.children('.active').removeClass('active');
$tabContents.children().eq(tabIndex).addClass('active')
});
var swiper = new Swiper(".mySwiper", {
spaceBetween: 30,
centeredSlides: true,
autoplay: {
delay: 2500,
disableOnInteraction: false,
},
pagination: {
el: ".swiper-pagination",
clickable: true,
},
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
});
</script>
</div>
본문에서 올리지마시고
스킨단에서 첨부파일을 로드해서 작업하시는게 나을것 같은데요...;
왜 본문에 올리시는지..
답변을 작성하시기 전에 로그인 해주세요.