...

View Full Version : Draggable Marquee ?!?



Neo
05-02-2004, 04:38 PM
Hello
Any body knows of any javascript that could make a draggable Marquee ?? in which people can drag the message forward and backwards ?!? Please Do share it if you have any... Thanks in Advance.

Neo
05-02-2004, 07:13 PM
Can anybody Help me ?!? :confused:

trib4lmaniac
05-02-2004, 08:28 PM
I wouldn't have thought that would be possible using a marquee tag, but it could possibly be done by creating your own 'marquee'. Can't be bothered to try tho :D

JAVAEOC
05-02-2004, 10:22 PM
Hold up Neo, I am trying to write a script for you, but it doesnt go just like that, it takes time, right now I just have to fix it for IE, then you can have it :D

JavaScriptdude
05-04-2004, 02:57 AM
Try this script :)


<html>
<head>

<script type="text/javascript">
<!--

drag = 0;
move = 0;

function setDiv(dragger)
{
dragDiv = dragger;
drag = 1;
}

function startdrag()
{
window.document.onmousedown = mouseDown;
window.document.onmouseup = mouseUp;
window.document.onmousemove = mouseMove;
window.document.ondragstart = mouseEnd;
}

function mouseDown()
{
if (drag==1)
{
clickleft = window.event.x - parseInt(dragDiv.style.left);
clicktop = window.event.y - parseInt(dragDiv.style.top);
move = 1;
}
}

function mouseEnd()
{
window.event.returnValue = false;
}

function mouseMove()
{
if (move==1)
{
dragDiv.style.left = window.event.x - clickleft;
dragDiv.style.top = window.event.y - clicktop;
}
}

function mouseUp()
{
move = 0
}

//-->
</script>
</head>
<body onLoad="startdrag()">
<div id="north" onMouseOver="setDiv(north)" style="cursor: move; position: absolute; left: 10; top: 35">
<center><MARQUEE direction="right" loop="20"
width="75%"><!--PUT YOUR TEXT HERE!!-->This is a test</center> </MARQUEE>
</div>
<div id="south" onMouseOver="setDiv(south)" style="cursor: move; position: absolute; left: 10; top: 5">

</div>
<div id="east" onMouseOver="setDiv(east)" style="cursor: move; position: absolute; left: 10; top: 20">

</div>
<div id="west" onMouseOver="setDiv(west)" style="cursor: move; position: absolute; left: 10; top: 50">

</div>

</div>
</body>
</html>

</MARQUEE>

Neo
05-05-2004, 11:26 AM
Hello
Dear Friend, I saw your code, but what i wanted was the draggable Message, this drages the whole marque across the browser... :confused:
i mean, the position of the Marque May remain the same but the Message of the marquee may be draggable ... is this possible ? :rolleyes:

trib4lmaniac
05-05-2004, 01:20 PM
I really don't think it's possible with a marquee element, unless it has a position attriute that i don't know about! You could probably make a variation on jsdude's script making the marquee a span and then only allowing to move up-down/left-right.

Kor
05-05-2004, 01:59 PM
I think you may drag-n-drop a marquee (same issue with dragging an iframe) . But I think you must clearTimeout the marquee function when start dragging, give display:none to the text while dragging, than reinitialize the values, display:inline the text and fire the startUp function when drop.

JavaScriptdude
05-05-2004, 02:24 PM
Then you might need to use something else like like a Java applet...

JavaScriptdude
05-06-2004, 11:38 PM
How about this?


<SCRIPT LANGUAGE="JavaScript">


<!-- Begin
var ostat = false;
function scrollstop() {
news.scrollAmount = 0;
ostat = true;
}
function scrollplay() {
news.scrollAmount = 5;
ostat = false;
}
function scrolldir() {
mid = screen.width / 2;
mouse = event.x;
if(mouse > mid) {
if(ostat == false) {
speed = (mouse - mid) / 25;
news.scrollAmount = speed;
}
news.direction = "right";
}
else {
if(ostat == false) {
speed = (mid - mouse) / 25;
news.scrollAmount = speed;
}
news.direction = "left";
}
}
// End -->
</script>

</HEAD>

<BODY onMouseMove="scrolldir()">

<marquee name=news id=news behavior=scroll direction=left scrollamount=5 scrolldelay=1 hspace=0 vspace=0 onmouseover="scrollstop()" onmouseout="scrollplay()">
<b>Put your message here . . . the message can be pulled in either direction by moving the mouse pointer to the left or the right. Stop the message by hovering the mouse pointer over it.</b>
</marquee>

JavaScriptdude
05-10-2004, 12:06 AM
Did the script work?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum