Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Bounty
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Display Multiple Marquee Div on Page
WhatsApp
Mohd Arif
Nov 24
2015
3.5
k
0
2
<html>
<head>
<title>Multiple Scroll Marquee on Page With Dynamic</title>
<style type=
"text/css"
>
.marqueecontainer {
position: relative;
width: 200px;
/*marquee width */
height: 200px;
/*marquee height */
background-color: white;
overflow: hidden;
border: 3px solid orange;
padding: 2px;
padding-left: 4px;
}
</style>
<script type=
"text/javascript"
>
function Marquee(o)
{
var oop =
this
,
obj = document.getElementById(o.ID),
top = 0;
var marquee = obj.getElementsByTagName(
'DIV'
)[0];
this
.marqueeheight = marquee.offsetHeight;
marquee.style.top = -
this
.marqueeheight +
'px'
;
this
.marquee = [marquee];
while
(top < obj.offsetHeight)
{
marquee = marquee.cloneNode(
true
);
marquee.style.top = top +
'px'
;
obj.appendChild(marquee);
this
.marquee.push(marquee);
top +=
this
.marqueeheight;
}
this
.Speed = o.marqueespeed;
setTimeout(function ()
{
setInterval(function ()
{
oop.scroll();
}, 30);
}, o.delayb4scroll)
}
Marquee.prototype.scroll = function ()
{
for
(var top, z0 = 0; z0 <
this
.marquee.length; z0++)
{
top = parseInt(
this
.marquee[z0].style.top) -
this
.Speed
this
.marquee[z0].style.top = top +
"px"
;
if
(top < -
this
.marqueeheight)
{
this
.marquee[z0].style.top = top +
this
.marqueeheight *
this
.marquee.length +
"px"
;
}
}
}
</script>
</head>
<body>
<div style=
"float:left;"
>
<div id=
"marqueecontainer"
class
=
"marqueecontainer"
onmouseover=
"M1.Speed=0;"
onmouseout=
"M1.Speed=2;"
onfocus=
"M1.Speed=0;"
>
<div style=
"position: absolute; width: 98%;"
> <a
class
=
'link_up'
title=
'Utter Pradesh'
href=
'#'
><span>1. Utter Pradesh</span></a>
<hr /> <a
class
=
'link_up'
title=
'Delhi'
href=
'#'
><span>2. Delhi</span></a>
<hr /> <a
class
=
'link_up'
title=
'Madhya Pradesh'
href=
'#'
><span>3. Madhya Pradesh</span></a>
<hr /> <a
class
=
'link_up'
title=
'Bihar'
href=
'#'
><span>4. Bihar</span></a>
<hr /> </div>
</div>
<div style=
'float: left; margin: 10px 10px 10px 0px;'
> <a href=
'javascript:M1.Speed=2;'
>Start Scroll</a></div>
<div style=
'float: left; margin: 10px 10px 10px 0px;'
> <a href=
'javascript:M1.Speed=0;'
>Pause Scroll</a></div>
<script type=
"text/javascript"
>
var M1 =
new
Marquee(
{
ID:
'marqueecontainer'
,
delayb4scroll: 2000,
marqueespeed: 2
});
</script>
<br />
<br />
<div id=
"marqueecontainer1"
class
=
"marqueecontainer"
onmouseover=
"M2.Speed=0;"
onmouseout=
"M2.Speed=2"
; onfocus=
"M2.Speed=0;"
>
<div style=
"position: absolute; width: 98%;"
> <a
class
=
'link_up'
title=
'Utter Pradesh'
href=
'#'
><span>1. Utter Pradesh</span></a>
<hr /> <a
class
=
'link_up'
title=
'Delhi'
href=
'#'
><span>2. Delhi</span></a>
<hr /> <a
class
=
'link_up'
title=
'Madhya Pradesh'
href=
'#'
><span>3. Madhya Pradesh</span></a>
<hr /> <a
class
=
'link_up'
title=
'Bihar'
href=
'#'
><span>4. Bihar</span></a>
<hr /> </div>
</div>
<div style=
'float: left; margin: 10px 10px 10px 0px;'
> <a href=
'javascript:M2.Speed=2;'
>Start Scroll</a></div>
<div style=
'float: left; margin: 10px 10px 10px 0px;'
> <a href=
'javascript:M2.Speed=0;'
>Pause Scroll</a></div>
<script type=
"text/javascript"
>
var M2 =
new
Marquee(
{
ID:
'marqueecontainer1'
,
delayb4scroll: 2000,
marqueespeed: 2
});
</script>
</div>
</body>
</html>
ASP.NET
Div
Multiple Marquee Div on Page
Up Next
Display Multiple Marquee Div on Page