1) Script Title: Cross Browser Marquee II
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex2/cmarquee2.htm
3) Describe problem: I'm trying to use CMII to have an ASP:Gridview scroll automatically. This has worked quite well, as opposed to a 3rd party function I found before which couldn't deal with the next part.
The CMII script is being run inside an ASP:Updatepanel for an asynchronous postback to update the Gridview. This occurs successfully, however afterwards the scrolling appears to have gone up to the next speed. (it's a 1-10 scale, I have it set to 1, so after each update I'm thinking it adds 1 to this number)
Hopefully it's something that can be adjusted with the CMII code, because just having the scrolling animation work after a weeks worth of smashing my face into the keyboard has been quite uplifting. XD
Code:<style type="text/css"> #marqueecontainer{ position: relative; width: 200px; /*marquee width */ height: 200px; /*marquee height */ background-color: gray; overflow: hidden; border: 1px solid black; padding: 2px; padding-left: 4px; } </style> <asp:UpdatePanel ID="UpdatePanel1" runat="server" > <Triggers> <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /> </Triggers> <ContentTemplate> <asp:Timer ID="Timer1" runat="server" Interval="20000" ontick="Timer1_Tick"></asp:Timer> <script type="text/javascript" > function endRequestHandler(sender, args) { initializemarquee(); } /*********************************************** * 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 function pageLoad() { if (!Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack()) Sys.WebForms.PageRequestManager.getInstance().add_endRequest(initializemarquee); } </script> <div id="marqueecontainer"> <div id="vmarquee" style="position: absolute; width: 98%;"> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="trc_number" DataSourceID="SqlDataSource1" > <Columns> <asp:BoundField DataField="trc_number" HeaderText="trc_number" ReadOnly="True" SortExpression="trc_number"></asp:BoundField> <asp:BoundField DataField="trc_status" HeaderText="trc_status" SortExpression="trc_status"></asp:BoundField> </Columns> </asp:GridView> </div> </div> </ContentTemplate> </asp:UpdatePanel>


Reply With Quote
Bookmarks