How to Implement Moving content/text in website like a marquee. In asp.net.
I have values in my data set.the data set value must be displayed in div like a rotating flash news...
Simple example to slide a div over the page:
<asp:Panel id="MovingContent" runat="server"
style="position:absolute;left:-100px;top:20px;height:40px;width:100px;">
The content that will move
</asp:Panel>
<script type="text/javascript">
//Initial position
//(should be the same as the position specified in the element's style)
posX = -100;
posY = 20;
//Position where the element will stop
targetX=200;
targetY=60;
function move(){
if(posX < targetX){
posX += 10;
if(posY < targetY) posY += 1;
var divElement = document.getElementById('<%=MovingContent.ClientID%>');
divElement.style.left = posX + 'px';
divElement.style.top = posY + 'px';
//Time in milliseconds to when to move next step
self.setTimeout('move()', 100);
}
}
move(); //Start the moving
</script>
You might improve it to your needs, but this can be used as a basic idea how to do it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With