[英]How to Implement Moving content/text in website. in asp.net
How to Implement Moving content/text in website like a marquee. 如何在网站中实现移动内容/文本,如选框。 In asp.net.
在asp.net中。
I have values in my data set.the data set value must be displayed in div like a rotating flash news... 我的数据集中有值。数据集值必须像div一样显示在div中...
Simple example to slide a div over the page: 在页面上滑动div的简单示例:
<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. 您可以根据自己的需要进行改进,但这可以作为一个基本的想法来实现。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.