묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
이미지스크롤에서 스크립트 인데 뭐가 잘못된지??
2006.08.31 10:29
1,아래에서 위로 이미지 스크롤 되는것인데.
한순번 돌면 빈칸이 생기고 또 스크롤이 되는데..
이 빈칸을 없애려면은 어떻게 해야 하는지요??
아래는 파일 내용입니다
<script language="javascript">
var roll_height_ibang = 200;
var total_area_ibang = 0;
var wait_flag_ibang = true;
var bMouseOver_ibang = 1;
var roll_speed_ibang = 1;
var waitingtime_ibang = 1000;
var s_tmp_ibang = 0;
var s_amount_ibang = 200;
var roll_text_ibang = new Array();
var startPanel_ibang = 0;
var n_panel_ibang = 0;
var i_ibang = 0;
function start_roll_ibang()
{
i_ibang = 0;
for (i_ibang in roll_text_ibang)
n_panel_ibang++;
n_panel_ibang = n_panel_ibang -1 ;
startPanel_ibang = Math.round(Math.random()*n_panel_ibang);
if(startPanel_ibang == 0)
{
i_ibang = 0;
for (i_ibang in roll_text_ibang)
insert_area_ibang(total_area_ibang, total_area_ibang++); // area 삽입
}
else if(startPanel_ibang == n_panel_ibang)
{
insert_area_ibang(startPanel_ibang, total_area_ibang);
total_area_ibang++;
for (i_ibang=0; i_ibang<startPanel_ibang; i_ibang++)
{
insert_area_ibang(i_ibang, total_area_ibang); // area 삽입
total_area_ibang++;
}
}
else if((startPanel_ibang > 0) || (startPanel_ibang < n_panel_ibang))
{
insert_area_ibang(startPanel_ibang, total_area_ibang);
total_area_ibang++;
for (i_ibang=startPanel_ibang+1; i_ibang<=n_panel_ibang; i_ibang++)
{
insert_area_ibang(i_ibang, total_area_ibang); // area 삽입
total_area_ibang++;
}
for (i_ibang=0; i_ibang<startPanel_ibang; i_ibang++)
{
insert_area_ibang(i_ibang, total_area_ibang); // area 삽입
total_area_ibang++;
}
}
if ( navigator.appName == "Microsoft Internet Explorer" )
{
if ( navigator.appVersion.indexOf ( "MSIE 4" ) > -1 )
return ;
}
window.setTimeout("rolling_ibang()",waitingtime_ibang);
}
function rolling_ibang()
{
if (bMouseOver_ibang && wait_flag_ibang)
{
for (i_ibang=0;i_ibang<total_area_ibang;i_ibang++){
tmp_ibang = document.getElementById('scroll_area_ibang'+i_ibang).style;
tmp_ibang.top = parseInt(tmp_ibang.top)-roll_speed_ibang;
if (parseInt(tmp_ibang.top) <= -roll_height_ibang){
tmp_ibang.top = roll_height_ibang*(total_area_ibang-1);
}
if (s_tmp_ibang++ > (s_amount_ibang-1)*roll_text_ibang.length){
wait_flag_ibang=false;
window.setTimeout("wait_flag_ibang=true;s_tmp_ibang=0;",waitingtime_ibang);
}
}
}
window.setTimeout("rolling_ibang()", 1);
}
function insert_area_ibang(idx_ibang, n_ibang)
{
document.write('<div style="left: 0px; width: 100%; position: absolute; top: '+ '+ '+(roll_height_ibang*n_ibang)+'px" id="scroll_area_ibang'+n_ibang+'">n'+roll_text_ibang[idx_ibang]+'n</div>n');
}
<?
include "./dbconn/DbConn.php";
$prodsql = "select * from product where img3 <> '' order by idx desc limit 12";
$sql1= mysql_query($prodsql) or die(mysql_error());
$i=0;
while($rows = mysql_fetch_array($sql1)){
$roll[$i] = "<img width='290' height='+ '190' src='imgs/$rows[img3]' border=0>";
$i++;
}
?>
roll_text_ibang[0]= "<table width='290' height='200' cellpadding='0' cellspacing='0' border='0' align='center'><tr><td valign='top'><?=$roll['0']?></td></tr></table>";
roll_text_ibang[1]= "<table width='290' height='200' cellpadding='0' cellspacing='0' border='0' align='center'><tr><td valign='top'><?=$roll['1']?></td></tr></table>";
roll_text_ibang[2]= "<table width='290' height='200' cellpadding='0' cellspacing='0' border='0' align='+ 'center'><tr><td valign='top'><?=$roll['2']?></td></tr></table>";
roll_text_ibang[3]= "<table width='290' height='200' cellpadding='0' cellspacing='0' border='0' align='center'><tr><td valign='top'><?=$roll['3']?></td></tr></table>";
roll_text_ibang[4]= "<table width='290' height='200' cellpadding='0' cellspacing='0' border='0' align='center'><tr><td valign='top'><?=$roll['4']?></td></tr></table>";
roll_text_ibang[5]= "<table width='290' height='200' cellpadding='0' cellspacing='0' border='0' align='center'><tr><td valign='top'><?=$roll['5']?></td></tr></table>";
roll_text_ibang[6]= "<table width='290' height='200' cellpadding='0' cellspacing='0'+ ' border='0' align='center'><tr><td valign='top'><?=$roll['6']?></td></tr></table>";
roll_text_ibang[7]= "<table width='290' height='200' cellpadding='0' cellspacing='0' border='0' align='center'><tr><td valign='top'><?=$roll['7']?></td></tr></table>";
roll_text_ibang[8]= "<table width='290' height='200' cellpadding='0' cellspacing='0'+ ' border='0' align='center'><tr><td valign='top'><?=$roll['8']?></td></tr></table>";
roll_text_ibang[9]= "<table width='290' height='200' cellpadding='0' cellspacing='0' border='0' align='+ 'center'><tr><td valign='top'><?=$roll['9']?></td></tr></table>";
roll_text_ibang[10]= "<table width='290' height='200' cellpadding='0' cellspacing='0' border='0' align='center'><tr><td valign='top'><?=$roll['10']?></td></tr></table>";
roll_text_ibang[11]= "<table width='290' height='200' cellpadding='0' cellspacing='0' border='0' align='center'><tr><td valign='top'><?=$roll['11']?></td></tr></table>";
roll_text_ibang[12]= "<table width='290' height='200' cellpadding='0' cellspacing='0' border='0' align='center'><tr><td valign='top'><?=$roll['12']?></td></tr></table>";
<?if($i>0){?>
<?}else{
?>
roll_text_ibang[1]= "";
<?
}?>
</script>
<div style="left:0px; width: 100%; position: relative; top: 0px; height: 200px; overflow:hidden;" onMouseover="bMouseOver_ibang=0" onMouseout="bMouseOver_ibang=1" id="scroll_image_ibang">
<script>
var no_script_flag_ibang = false ;
if ( navigator.appName == "Microsoft Internet Explorer" )
{
if ( navigator.appVersion.indexOf ( "MSIE 4" ) > -1 )
{
document.write ( roll_text_ibang[0] ) ;
no_script_flag_ibang = true ;
}
}
if ( no_script_flag_ibang == false )
start_roll_ibang();
</script>
</div>
고수님들 알려 주시면 감사하겠습니다
(출처 : '이미지 스크롤시 스크립트입니다...' - 네이버 지식iN)
한순번 돌면 빈칸이 생기고 또 스크롤이 되는데..
이 빈칸을 없애려면은 어떻게 해야 하는지요??
아래는 파일 내용입니다
<script language="javascript">
var roll_height_ibang = 200;
var total_area_ibang = 0;
var wait_flag_ibang = true;
var bMouseOver_ibang = 1;
var roll_speed_ibang = 1;
var waitingtime_ibang = 1000;
var s_tmp_ibang = 0;
var s_amount_ibang = 200;
var roll_text_ibang = new Array();
var startPanel_ibang = 0;
var n_panel_ibang = 0;
var i_ibang = 0;
function start_roll_ibang()
{
i_ibang = 0;
for (i_ibang in roll_text_ibang)
n_panel_ibang++;
n_panel_ibang = n_panel_ibang -1 ;
startPanel_ibang = Math.round(Math.random()*n_panel_ibang);
if(startPanel_ibang == 0)
{
i_ibang = 0;
for (i_ibang in roll_text_ibang)
insert_area_ibang(total_area_ibang, total_area_ibang++); // area 삽입
}
else if(startPanel_ibang == n_panel_ibang)
{
insert_area_ibang(startPanel_ibang, total_area_ibang);
total_area_ibang++;
for (i_ibang=0; i_ibang<startPanel_ibang; i_ibang++)
{
insert_area_ibang(i_ibang, total_area_ibang); // area 삽입
total_area_ibang++;
}
}
else if((startPanel_ibang > 0) || (startPanel_ibang < n_panel_ibang))
{
insert_area_ibang(startPanel_ibang, total_area_ibang);
total_area_ibang++;
for (i_ibang=startPanel_ibang+1; i_ibang<=n_panel_ibang; i_ibang++)
{
insert_area_ibang(i_ibang, total_area_ibang); // area 삽입
total_area_ibang++;
}
for (i_ibang=0; i_ibang<startPanel_ibang; i_ibang++)
{
insert_area_ibang(i_ibang, total_area_ibang); // area 삽입
total_area_ibang++;
}
}
if ( navigator.appName == "Microsoft Internet Explorer" )
{
if ( navigator.appVersion.indexOf ( "MSIE 4" ) > -1 )
return ;
}
window.setTimeout("rolling_ibang()",waitingtime_ibang);
}
function rolling_ibang()
{
if (bMouseOver_ibang && wait_flag_ibang)
{
for (i_ibang=0;i_ibang<total_area_ibang;i_ibang++){
tmp_ibang = document.getElementById('scroll_area_ibang'+i_ibang).style;
tmp_ibang.top = parseInt(tmp_ibang.top)-roll_speed_ibang;
if (parseInt(tmp_ibang.top) <= -roll_height_ibang){
tmp_ibang.top = roll_height_ibang*(total_area_ibang-1);
}
if (s_tmp_ibang++ > (s_amount_ibang-1)*roll_text_ibang.length){
wait_flag_ibang=false;
window.setTimeout("wait_flag_ibang=true;s_tmp_ibang=0;",waitingtime_ibang);
}
}
}
window.setTimeout("rolling_ibang()", 1);
}
function insert_area_ibang(idx_ibang, n_ibang)
{
document.write('<div style="left: 0px; width: 100%; position: absolute; top: '+ '+ '+(roll_height_ibang*n_ibang)+'px" id="scroll_area_ibang'+n_ibang+'">n'+roll_text_ibang[idx_ibang]+'n</div>n');
}
<?
include "./dbconn/DbConn.php";
$prodsql = "select * from product where img3 <> '' order by idx desc limit 12";
$sql1= mysql_query($prodsql) or die(mysql_error());
$i=0;
while($rows = mysql_fetch_array($sql1)){
$roll[$i] = "<img width='290' height='+ '190' src='imgs/$rows[img3]' border=0>";
$i++;
}
?>
roll_text_ibang[0]= "<table width='290' height='200' cellpadding='0' cellspacing='0' border='0' align='center'><tr><td valign='top'><?=$roll['0']?></td></tr></table>";
roll_text_ibang[1]= "<table width='290' height='200' cellpadding='0' cellspacing='0' border='0' align='center'><tr><td valign='top'><?=$roll['1']?></td></tr></table>";
roll_text_ibang[2]= "<table width='290' height='200' cellpadding='0' cellspacing='0' border='0' align='+ 'center'><tr><td valign='top'><?=$roll['2']?></td></tr></table>";
roll_text_ibang[3]= "<table width='290' height='200' cellpadding='0' cellspacing='0' border='0' align='center'><tr><td valign='top'><?=$roll['3']?></td></tr></table>";
roll_text_ibang[4]= "<table width='290' height='200' cellpadding='0' cellspacing='0' border='0' align='center'><tr><td valign='top'><?=$roll['4']?></td></tr></table>";
roll_text_ibang[5]= "<table width='290' height='200' cellpadding='0' cellspacing='0' border='0' align='center'><tr><td valign='top'><?=$roll['5']?></td></tr></table>";
roll_text_ibang[6]= "<table width='290' height='200' cellpadding='0' cellspacing='0'+ ' border='0' align='center'><tr><td valign='top'><?=$roll['6']?></td></tr></table>";
roll_text_ibang[7]= "<table width='290' height='200' cellpadding='0' cellspacing='0' border='0' align='center'><tr><td valign='top'><?=$roll['7']?></td></tr></table>";
roll_text_ibang[8]= "<table width='290' height='200' cellpadding='0' cellspacing='0'+ ' border='0' align='center'><tr><td valign='top'><?=$roll['8']?></td></tr></table>";
roll_text_ibang[9]= "<table width='290' height='200' cellpadding='0' cellspacing='0' border='0' align='+ 'center'><tr><td valign='top'><?=$roll['9']?></td></tr></table>";
roll_text_ibang[10]= "<table width='290' height='200' cellpadding='0' cellspacing='0' border='0' align='center'><tr><td valign='top'><?=$roll['10']?></td></tr></table>";
roll_text_ibang[11]= "<table width='290' height='200' cellpadding='0' cellspacing='0' border='0' align='center'><tr><td valign='top'><?=$roll['11']?></td></tr></table>";
roll_text_ibang[12]= "<table width='290' height='200' cellpadding='0' cellspacing='0' border='0' align='center'><tr><td valign='top'><?=$roll['12']?></td></tr></table>";
<?if($i>0){?>
<?}else{
?>
roll_text_ibang[1]= "";
<?
}?>
</script>
<div style="left:0px; width: 100%; position: relative; top: 0px; height: 200px; overflow:hidden;" onMouseover="bMouseOver_ibang=0" onMouseout="bMouseOver_ibang=1" id="scroll_image_ibang">
<script>
var no_script_flag_ibang = false ;
if ( navigator.appName == "Microsoft Internet Explorer" )
{
if ( navigator.appVersion.indexOf ( "MSIE 4" ) > -1 )
{
document.write ( roll_text_ibang[0] ) ;
no_script_flag_ibang = true ;
}
}
if ( no_script_flag_ibang == false )
start_roll_ibang();
</script>
</div>
고수님들 알려 주시면 감사하겠습니다
(출처 : '이미지 스크롤시 스크립트입니다...' - 네이버 지식iN)