Results 1 to 5 of 5

Thread: JavaScript for Translucent Scroller

  1. #1
    Join Date
    Aug 2006
    Posts
    332

    JavaScript for Translucent Scroller

    Hiii Friends,
    I want to make some effects on my web page. Actually I am looking for the "translucent" scroller. I want to write it in JavaScript. The scroller should turn semi-transparent, when I change the message as the next message slides up to cover the old. I think that you guys have got my point. So can anyone help me by providing the sample of JavaScript for Translucent Scroller. Thanks in Advance.!!!
    Do not email me asking for tech support. Any private support is billable at $50 an hour.

  2. #2
    Join Date
    Feb 2008
    Posts
    1,852

    Re: JavaScript for Translucent Scroller

    I got what exactly you want. You want your scroller should turn semi-transparent, when you change the message. You can do this effect by using the Flash. But now you can write the script for the same.!! The main thing you will have to keep in mind that your browser like Internet Explorer, Mozilla Firefox, etc. should be updated to the latest version. Otherwise the script will not work. Hope that you got some basic and important points from this post..!!

  3. #3
    Join Date
    Mar 2008
    Posts
    672

    Re: JavaScript for Translucent Scroller

    In simple words you can say that, Translucent Scroller is a multi-platform compatible translucent scroller turns semi transparent in between message changes. Also you can download the javascript from the web for free. Afte downloading the script, you will able to see the effects in your web page. Also once you download the specific files, you can easily configure the width/height, color, and contents of the scroller by changing the variables inside the script. Hope that it helps.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: JavaScript for Translucent Scroller

    I thought that providing the sample of the code would be much useful for you. So, I have given you the sample of the coding that you have to add where you wish the scroller to appear in the <body> section. Here is the code for that :
    Code:
    <script language="JavaScript1.2">
    
    var scroller_width='175px'
    var scroller_height='130px'
    var bgcolor='#0000ff'
    var pause=4000
    
    var scrollercontent=new Array()
    scrollercontent[0]='Visit our partner site <a href="http://freewarejava.com">Freewarejava.com </a>for free Java applets!'
    scrollercontent[1]='Got JavaScript? <a href="http://www.javascriptkit.com">JavaScript Kit</a> is the most comprehensive JavaScript site online.'
    scrollercontent[2]='Link to Demos on your site. Please visit our <a href="http://www.demos.com/link.htm">links page</a>.'
    
    var ie4=document.all
    var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1
    
    if (ie4||dom)
    document.write('<div style="position:relative;width:'+scroller_width+';height:'+scroller_height+';overflow:hidden"><div id="canvas0" style="position:absolute;background-color:'+bgcolor+';width:'+scroller_width+';height:'+scroller_height+';top:'+scroller_height+';filter:alpha(opacity=20);-moz-opacity:0.2;"></div><div id="canvas1" style="position:absolute;background-color:'+bgcolor+';width:'+scroller_width+';height:'+scroller_height+';top:'+scroller_height+';filter:alpha(opacity=20);-moz-opacity:0.2;"></div></div>')
    else if (document.layers){
    document.write('<ilayer id=tickernsmain visibility=hide width='+scroller_width+' height='+scroller_height+' bgColor='+bgcolor+'><layer id=tickernssub width='+scroller_width+' height='+scroller_height+' left=0 top=0>'+scrollercontent[0]+'</layer></ilayer>')
    }
    
    var curpos=scroller_height*(1)
    var degree=10
    var curcanvas="canvas0"
    var curindex=0
    var nextindex=1
    
    function moveslide(){
    if (curpos>0){
    curpos=Math.max(curpos-degree,0)
    tempobj.style.top=curpos+"px"
    }
    else{
    clearInterval(dropslide)
    if (crossobj.filters)
    crossobj.filters.alpha.opacity=100
    else if (crossobj.style.MozOpacity)
    crossobj.style.MozOpacity=1
    nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
    tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
    tempobj.innerHTML=scrollercontent[curindex]
    nextindex=(nextindex<scrollercontent.length-1)? nextindex+1 : 0
    setTimeout("rotateslide()",pause)
    }
    }
    </script>
    Last edited by kelfro; 07-02-2010 at 01:24 AM.

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Re: JavaScript for Translucent Scroller

    The code mentioned by the 'kelfro', is not properly completed. You will have to add the function rotateslide(), for making the effect of the scroller to be translucent. You can continue the below mentioned code after using the code mentioned by 'kelfro'. You can have a look on the following code :
    Code:
    <script language="JavaScript1.2">
    
    var scroller_width='175px'
    var scroller_height='130px'
    var bgcolor='#0000ff'
    var pause=4000
    
    function rotateslide(){
    if (ie4||dom){
    resetit(curcanvas)
    crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
    crossobj.style.zIndex++
    if (crossobj.filters)
    document.all.canvas0.filters.alpha.opacity=document.all.canvas1.filters.alpha.opacity=20
    else if (crossobj.style.MozOpacity)
    document.getElementById("canvas0").style.MozOpacity=document.getElementById("canvas1").style.MozOpacity=0.2
    var temp='setInterval("moveslide()",50)'
    dropslide=eval(temp)
    curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
    }
    else if (document.layers){
    crossobj.document.write(scrollercontent[curindex])
    crossobj.document.close()
    }
    curindex=(curindex<scrollercontent.length-1)? curindex+1 : 0
    }
    
    function resetit(what){
    curpos=parseInt(scroller_height)*(1)
    var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
    crossobj.style.top=curpos+"px"
    }
    
    function startit(){
    crossobj=ie4? eval("document.all."+curcanvas) : dom? document.getElementById(curcanvas) : document.tickernsmain.document.tickernssub
    if (ie4||dom){
    crossobj.innerHTML=scrollercontent[curindex]
    rotateslide()
    }
    else{
    document.tickernsmain.visibility='show'
    curindex++
    setInterval("rotateslide()",pause)
    }
    }
    
    if (ie4||dom||document.layers)
    window.onload=startit
    
    </script>

Similar Threads

  1. Javascript in IE on HTC HD2
    By dONGsUN in forum Portable Devices
    Replies: 4
    Last Post: 06-10-2010, 05:56 AM
  2. help with javascript please!
    By newbie1 in forum Software Development
    Replies: 2
    Last Post: 08-05-2010, 11:09 AM
  3. How to create Translucent and Shaped Windows in Java?
    By Silent~Kid in forum Software Development
    Replies: 4
    Last Post: 14-02-2010, 06:20 AM
  4. Php form with javascript
    By Solaris in forum Software Development
    Replies: 3
    Last Post: 30-11-2009, 02:22 PM
  5. Translucent taskbar
    By Jokerz in forum Customize Desktop
    Replies: 2
    Last Post: 05-12-2008, 04:57 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,208,772.83133 seconds with 17 queries