Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: [MOD] Using extra contents for a News Scroller! (sNews 1.5)  (Read 5276 times)

Richard Waters

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 88
    • http://www.richardsmagic.com
[MOD] Using extra contents for a News Scroller! (sNews 1.5)
« on: September 28, 2006, 10:12:53 AM »

I thought I would finally put some effort into dropping something back into here for all the help everyone has given me - I still have a few questions unanswered and Im looking forward to the final release of 1.5 but Im still playing with it and when its done, my site will be up.

But for now, just in case ur interested:  I wanted to have a "Attention: News!" section on the website that sat in the corner and scrolled the little one liners needed for different things - so I decided to, instead of using an include and a file (which I tested and also works great!) I would use the EXTRA to post to the scroller - that way I dont have to change code or anything - just login, add or subtract the news that was there and logout!

SIMPLE!  I think!  :P  Anyhow, he's what I did:

1)  In the HEAD place this script:

Quote
<!-- Javascript for scroller goes here-->
<script language="javascript">
i = 0
var speed = 2
function scroll() {
i = i + speed
var div = document.getElementById("news")
div.scrollTop = i
if (i > div.scrollHeight - 160) {i = 0}
t1=setTimeout("scroll()",100)
}
</script>   
<!-- Javascript for scroller goes here-->
2)  Place this code where you would like the scroller:

Quote
<div class="extraframe" id="news">
<? extra(); ?>
</div>


<input type="button" value="Stop" onclick="clearTimeout(t1)">
<input type="button" value="Start" onclick="scroll()">
3)  And here is the CSS I used to style it for my website:

Quote
.extraframe
{
margin-top: 130px;
margin-left: 10px;
padding-left: 20px;
padding-top: 10px;
overflow: hidden;
background-color: none;
width:190px;
height:200px;
color: #333333;
}

.extraframe h3
{
padding-top: 15px;
color: #b3000a;
}
Now of course, ur CSS will be a little different, but if you want to play around with it, just add it to a blank page and see what happens - a little trial and error and I got it exactly where I wanted it.

Now, Im no Javascript programmer, I just used a few little script ideas and put them together to get this - Im sure you could find a better script, I just like this cos I did it and its small and neat.

If you want to make it go faster or slower, then increase the js "var speed" setting, for my site, the "2" seemed perfect, but "4" was ok as well!

The stop and go buttons could prob be givien then own class and styled, or even their own DIV if you want, and as for the CSS, Im sure there is some redundant stuff in there - you can clean it up if you like.

I cant WC3 it cos its on the localhost at the moment, but if anyone tries it and finds a proplem please let me know?!  I will see if I can clean it up as time goes by, as I only programmed it about 15min ago and it didnt take me long - Im sure there is a pro out there shaking his/her head at me and the way the whole things goes!

I hope someone can use it - cos I think I did well for a first try!  ENJOY!!

:D -- Rich!
« Last Edit: March 30, 2009, 06:00:59 PM by Joost »
Logged
Transported to a surreal landscape, a young girl kills the first woman she meets and then teams up with three complete strangers to kill again!
:D -- The Wizard Of Oz

iatbm

  • Sr. Member
  • ****
  • Karma: 0
  • Posts: 251
    • Public domain photos
[MOD] Using extra contents for a News Scroller! (sNews 1.5)
« Reply #1 on: September 28, 2006, 12:03:30 PM »

this will come handy thanks !

Richard Waters

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 88
    • http://www.richardsmagic.com
[MOD] Using extra contents for a News Scroller! (sNews 1.5)
« Reply #2 on: September 28, 2006, 11:25:12 PM »

Glad someone thinks so - I wish I had the website public so I could show everyone.  I really do think that it looks good.

And because I needed to do "Qucikies" on the website because I travel, all the FTP stuffs and uploading and changing would have been a pain.  So using EXTRA was the answer.

Should also mention that while it sites in the frame, if you position it well on your website, it will list all of the EXTRA content for screen readers and when you have a PRINT stylesheet.

:D
Logged
Transported to a surreal landscape, a young girl kills the first woman she meets and then teams up with three complete strangers to kill again!
:D -- The Wizard Of Oz

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
[MOD] Using extra contents for a News Scroller! (sNews 1.5)
« Reply #3 on: September 29, 2006, 07:32:33 AM »

Goodie, Rich... We also wish you had it online, so we could see it :) ... Never the less, it sounds good, and I will probably try it out later... Thanks for this, mo'n
Logged
"It's only dead fish that goes with the flow... "
Updated

Mohd Fadli Saad

  • Newbie
  • *
  • Karma: 0
  • Posts: 26
  • business as usual
    • apadmedia.com
[MOD] Using extra contents for a News Scroller! (sNews 1.5)
« Reply #4 on: March 21, 2007, 04:50:13 AM »

I have try it, it appear but not scrolling.so how to fix it?

Mohd Fadli Saad

  • Newbie
  • *
  • Karma: 0
  • Posts: 26
  • business as usual
    • apadmedia.com
[MOD] Using extra contents for a News Scroller! (sNews 1.5)
« Reply #5 on: March 27, 2007, 03:33:12 AM »

Quote from: apad
I have try it, it appear but not scrolling.so how to fix it?
Thanks God for 2 days i've found the solution. :lol:

rubenam

  • Newbie
  • *
  • Karma: 0
  • Posts: 14
Re: [MOD] Using extra contents for a News Scroller! (sNews 1.5)
« Reply #6 on: March 30, 2009, 05:43:25 PM »

Hello, the code of the script, not appears... can you repost?

Thanks
Logged

Joost

  • Guest
Re: [MOD] Using extra contents for a News Scroller! (sNews 1.5)
« Reply #7 on: March 30, 2009, 06:02:06 PM »

Hello, the code of the script, not appears... can you repost?

Thanks
done
Logged