...

View Full Version : Ticker Box / Scroller slides



fiz
11-05-2012, 04:42 PM
Hi People,

I'm quite new to PHP and am abit stuck. I have got a Ticker box/ scroller that is working. The Ticker Box has 10 fixed slides which loop fine however if i leave one slide empty i end up with a large blank space before it goes back to the first slide. I would like to tell the script to go back to the first slide after the last populated slide. Any suggestion on how i can do this will be much appreciated.:)

Please see code below:

<html><head>
<title>News Feed</title>
<style type="text/css">
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
color:#616161;
font-family:Arial,Helvetica,sans-serif;
font-size:12px;
background-color:e6f2f5;
}

#NewsDiv { position: absolute; left: 0; top: 0; width:480px; text-align:left; padding-left:15px; padding-right:15px;}


a {
font-family:Arial,Helvetica,sans-serif;
color: #00a4b5;
font-size:12px;
text-decoration:underline;
}

a:hover {
font-family:Arial,Helvetica,sans-serif;
color: #00a4b5;
font-size:12px;
text-decoration:none;
}

h1 {
margin-top:0px;
margin-bottom:20px;
font-family: Arial, Helvetica, sans-serif;
font-weight: normal;
font-size:23px;
line-height:23px;
}

h2 {
margin:0px;
font-family: Arial, Helvetica, sans-serif;
color:#5e5e5e;
text-align: left;
font-weight:200;
font-size:18px;
line-height:18px;
}

h3 {
margin:0px;
padding-top:13px;
font-family: Arial, Helvetica, sans-serif;
color: #00a4b5;
}

.h1 {
font-size: 2.3em;
}

.h2 {
font-size: 18px;
color: #842b37;
margin-bottom:4px;
line-height:20px;
}

.brown {color: #842b37;}

.h3 {
font-size: 18px;
color: #00a4b5;
width:190px;
line-height:28px;
margin-bottom:10px;
border-bottom: 1px solid #00a4b5;
}

.bold {font-size: 130%; font-weight:bold;}

</style>

</head>



<BODY onMouseover="scrollspeed=0" onMouseout="scrollspeed=current" OnLoad="NewsScrollStart();">

<div id="NewsDiv"><br>

<h2 class="brown">What's New:</h2>

<?php $lcms_item_filename = 'news_scroller.txt'; ?>
<?php $from_here_to_top_level = './'; // Relative path to top level dir ?>
<?php $rel_path_to_lcms_area='./user_controlled_lcms_area'; // From top level dir ?>
<?php require($from_here_to_top_level.$rel_path_to_lcms_area."/core_snippet_code.php"); ?>

</div>


<!-- YOU DO NOT NEED TO EDIT BELOW THIS LINE -->




<script language="JavaScript" type="text/javascript">
<!-- HIDE CODE


var scrollspeed = "1" // SET SCROLLER SPEED 1 = SLOWEST
var speedjump = "30" // ADJUST SCROLL JUMPING = RANGE 20 TO 40
var startdelay = "3" // START SCROLLING DELAY IN SECONDS
var nextdelay = "0" // SECOND SCROLL DELAY IN SECONDS 0 = QUICKEST
var topspace = "0px" // TOP SPACING FIRST TIME SCROLLING
var frameheight = "130px" // IF YOU RESIZE THE WINDOW EDIT THIS HEIGHT TO MATCH


current = (scrollspeed)


function HeightData(){
AreaHeight=dataobj.offsetHeight
if (AreaHeight==0){
setTimeout("HeightData()",( startdelay * 1000 ))
}
else {
ScrollNewsDiv()
}}

function NewsScrollStart(){
dataobj=document.all? document.all.NewsDiv : document.getElementById("NewsDiv")
dataobj.style.top=topspace
setTimeout("HeightData()",( startdelay * 1000 ))
}

function ScrollNewsDiv(){
dataobj.style.top=parseInt(dataobj.style.top)-(scrollspeed)
if (parseInt(dataobj.style.top)<AreaHeight*(-1)) {
dataobj.style.top=frameheight
setTimeout("ScrollNewsDiv()",( nextdelay * 1000 ))
}
else {
setTimeout("ScrollNewsDiv()",speedjump)
}}



// END HIDE CODE -->
</script>


</body>
</html>

Fou-Lu
11-05-2012, 05:19 PM
Not a PHP issue, nor a Java issue. Moving from Java forum to javascript forum.
Also, in the future please wrap code in
or
to preserve the formatting.

fiz
11-06-2012, 08:58 AM
Thank you Fou-Lu

vwphillips
11-06-2012, 09:47 AM
function ScrollNewsDiv(){
dataobj.style.top=parseInt(dataobj.style.top)-(scrollspeed)+'px';
if (parseInt(dataobj.style.top)<AreaHeight*(-1)) {
dataobj.style.top='0px';
setTimeout("ScrollNewsDiv()",( nextdelay * 1000 ))
}
else {
setTimeout("ScrollNewsDiv()",speedjump)
}
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum