[질문추가] 최신글 이미지슬라이더 두번 넣으면 하나가 작동을 안해요 > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

[질문추가] 최신글 이미지슬라이더 두번 넣으면 하나가 작동을 안해요 정보

[질문추가] 최신글 이미지슬라이더 두번 넣으면 하나가 작동을 안해요

본문

현재 홈페이지 인덱스에

http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=94460&sca=%C3%D6%BD%C5%B1%DB&page=2

이 최신글 스킨을 두번 쓰려고 합니다

그래서 아래와 같이 두번을 넣어줬는데요
(스킨도 두개로 따로 썼고 출력할 테이블명도 두개로 나눠서 만들었습니다.)

<?=latest("newsslider", "banner1", 5, 25);?>
<?=latest("newsslider2", "banner2", 5, 25);?>


근데 위에껀 정상작동하는데 아래껀 슬라이드가 되지가 않네요..(첫번째 게시글로만 고정)

대체 소스의 어딜 수정해야 할까요?
답변부탁드려요~ 감사합니다 ^^
  • 복사

댓글 전체

<?=latest("newsslider", "banner1", 5, 25);?>
<?=latest("newsslider", "banner2", 5, 25);?>

################# newsslider.css  ###################
a:link, a:visited, a:active { text-decoration:none; color:.fff; }
a:hover { text-decoration:underline; }

.slider {

/* You MUST specify the width and height */
width:300px;
height:186px;
position:relative;
overflow:hidden;
}

.mask-gallery {

overflow:hidden;
}

.gallery {

/* Clear the list style */
list-style:none;
margin:0;
padding:0;

z-index:0;

/* width = total items multiply with .mask gallery width */
width:900px;
overflow:hidden;
}

.gallery li {


/* float left, so that the items are arrangged horizontally */
float:left;
}


.mask-excerpt {

/* Set the position */
position:absolute;
top:0;
left:0;
z-index:500px;

/* width should be lesser than .slider width */
width:100px;
overflow:hidden;


}

.excerpt {
/* Opacity setting for different browsers */
filter:alpha(opacity=60);
-moz-opacity:0.6; 
-khtml-opacity: 0.6;
opacity: 0.6; 

/* Clear the list style */
list-style:none;
margin:0;
padding:0;

/* Set the position */
z-index:10;
position:absolute;
top:0;
left:0;

/* Set the style */
width:100px;
background-color:.000;
overflow:hidden;
font-family:Tahoma,굴림;
font-size:9pt;
color:.fff;

}

.excerpt li {
padding:5px;
}



.clear {
clear:both;
}

############### latest.skin.php  ########################

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$img_width = '300'; //썸네일 가로길이
$img_height = '186'; //썸네일 세로길이
$img_quality = '9'; //퀼리티 100이하로 설정

if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 갤러리 게시판 입니다.");

$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb_newsslider'; //썸네일 이미지 생성 디렉토리

@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
?>

<link rel="stylesheet" href="<?=$latest_skin_path?>/css/newsslider.css" type="text/css">
<script type="text/javascript" src="<?=$latest_skin_path?>/js/jquery-1.3.1.min.js"></script>
<script type="text/javascript" src="<?=$latest_skin_path?>/js/jquery.scrollTo.js"></script>
<script>

$(document).ready(function() {

//Speed of the slideshow
var speed = 5000;

//You have to specify width and height in .slider CSS properties
//After that, the following script will set the width and height accordingly
$('.mask-gallery, .gallery li').width($('.slider').width());
$('.gallery').width($('.slider').width() * $('.gallery li').length);
$('.mask-gallery, .gallery li, .mask-excerpt, .excerpt li').height($('.slider').height());

//Assign a timer, so it will run periodically
var run = setInterval('newsscoller(0)', speed);

$('.gallery li:first, .excerpt li:first').addClass('selected');

//Pause the slidershow with clearInterval
$('.btn-pause').click(function () {
clearInterval(run);
return false;
});

//Continue the slideshow with setInterval
$('.btn-play').click(function () {
run = setInterval('newsscoller(0)', speed);
return false;
});

//Next Slide by calling the function
$('.btn-next').click(function () {
newsscoller(0);
return false;
});

//Previous slide by passing prev=1
$('.btn-prev').click(function () {
newsscoller(1);
return false;
});

//Mouse over, pause it, on mouse out, resume the slider show
$('.slider').hover(

function() {
clearInterval(run);
},
function() {
run = setInterval('newsscoller(0)', speed);
}
);

});


function newsscoller(prev) {

//Get the current selected item (with selected class), if none was found, get the first item
var current_image = $('.gallery li.selected').length ? $('.gallery li.selected') : $('.gallery li:first');
var current_excerpt = $('.excerpt li.selected').length ? $('.excerpt li.selected') : $('.excerpt li:first');

//if prev is set to 1 (previous item)
if (prev) {

//Get previous sibling
var next_image = (current_image.prev().length) ? current_image.prev() : $('.gallery li:last');
var next_excerpt = (current_excerpt.prev().length) ? current_excerpt.prev() : $('.excerpt li:last');

//if prev is set to 0 (next item)
} else {

//Get next sibling
var next_image = (current_image.next().length) ? current_image.next() : $('.gallery li:first');
var next_excerpt = (current_excerpt.next().length) ? current_excerpt.next() : $('.excerpt li:first');
}

//clear the selected class
$('.excerpt li, .gallery li').removeClass('selected');

//reassign the selected class to current items
next_image.addClass('selected');
next_excerpt.addClass('selected');

//Scroll the items
$('.mask-gallery').scrollTo(next_image, 800);
$('.mask-excerpt').scrollTo(next_excerpt, 800);

}
</script>
<div class="debug"></div>

<div class="slider">

<div class="mask-gallery">
<ul class="gallery">
<? for ($i=0; $i<count($list); $i++) {

$img = "<img src='$latest_skin_path/img/noimage.gif' width='$img_width' height='$img_height' title='이미지 없음' />";

$thumb = $thumb_path.'/'.$list[$i][wr_id];

if (!file_exists($thumb)) {
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
// 업로드된 파일이 이미지라면
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file)) {
$size = getimagesize($file);
if ($size[2] == 1)
$src = imagecreatefromgif($file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
break;

$rate = $img_width / $size[0];
$height = (int)($size[1] * $rate);

// 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
if ($height < $img_height)
// 계산된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $height);
else
// 설정된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $img_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}


if (file_exists($thumb)){
$img = "<li><img src='$thumb' width='$img_width' height='$img_height' alt=\"\" title=\"{$list[$i][subject]}\"/></li>";
}

echo $img;
} ?>
</ul>
</div>

<div class="mask-excerpt">
<ul class="excerpt">
<? for ($i=0; $i<count($list); $i++) {

$content = "<li><a href='{$list[$i]['href']}'>". $list[$i]['subject']."<br /><br />" . cut_str(strip_tags($list[$i][wr_content]),200,"…") . "</a></li>";

echo $content;
} ?>
</ul>
</div>

</div>



<div class="clear"></div>
아.. 슈와이님.. 정말 감사합니다.. 근데 문제가 좀 있네요.. 둘다 동작이 되긴하는데 5초마다 돌아가게 되어있잖아요? 근데 5초가 지나면 둘다 두페이지가 넘어갑니다.. ;;;;
© SIRSOFT
현재 페이지 제일 처음으로