Results 1 to 3 of 3

Thread: Cross Browser marquee II and show / hide

  1. #1
    Join Date
    Aug 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Cross Browser marquee II and show / hide

    1) Script Title:
    Cross Browser marquee II

    2) Script URL (on DD):
    http://www.dynamicdrive.com/dynamicindex2/cmarquee2.htm

    3) Describe problem:

    I have a html page with absolute positioned z-indexed layers.

    In two of the layers I have the above scroller with different contents scrolling.

    The first layer is seen as the page loads and the scroller is working fine.
    In the second, the view is hidden until a button is clicked. It does appear upon click though it does not scroll.

    I ran a test and put two scrollers on one page, both visible, and only one of the scrollers load.


    I have two issues to solve:
    1 - I need the script to work with multiple scrollers in a html file

    2 - I need the script to work on an item in the same page that is initially hidden and made visible with a button click


    This is the script used in the cross browser marquee:

    /***********************************************
    * Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit http://www.dynamicdrive.com/ for this script and 100s more.
    ***********************************************/

    var delayb4scroll=2000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
    var marqueespeed=1 //Specify marquee scroll speed (larger is faster 1-10)
    var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?

    ////NO NEED TO EDIT BELOW THIS LINE////////////

    var copyspeed=marqueespeed
    var pausespeed=(pauseit==0)? copyspeed: 0
    var actualheight=''

    function scrollmarquee(){
    if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8)) //if scroller hasn't reached the end of its height
    cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px" //move scroller upwards
    else //else, reset to original position
    cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
    }

    function initializemarquee(){
    cross_marquee=document.getElementById("vmarquee")
    cross_marquee.style.top=0
    marqueeheight=document.getElementById("marqueecontainer").offsetHeight
    actualheight=cross_marquee.offsetHeight //height of marquee content (much of which is hidden from view)
    if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
    cross_marquee.style.height=marqueeheight+"px"
    cross_marquee.style.overflow="scroll"
    return
    }
    setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll)
    }

    if (window.addEventListener)
    window.addEventListener("load", initializemarquee, false)
    else if (window.attachEvent)
    window.attachEvent("onload", initializemarquee)
    else if (document.getElementById)
    window.onload=initializemarquee

    </script>

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I'm not sure what you mean by number 2, though I suppose the visibility property of a scroller could be toggled if that's what you are looking for. Number 1 requires a rewrite like here:

    http://home.comcast.net/~jscheuer1/s...oo_c_slide.htm

    Use your browser's 'view source' to see the code.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Aug 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you for the help John.

    I'll take a look into the link.

    In #2 the show/hide is not so important. This is a test to verify an issue. I've tested it in spry and another ajax script. If it's in the HTML page and is not initially visible, it does not scroll when it becomes visible (ie: within an internal tabbed navigation). If it were Actionscript, I could tell it to play(); though my attempts to alter the javascript have not yet provided a solution.

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
  •