Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    Neo
    Neo is offline
    New to the CF scene
    Join Date
    May 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Draggable Marquee ?!?

    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.

  • #2
    Neo
    Neo is offline
    New to the CF scene
    Join Date
    May 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Can anybody Help me ?!?

  • #3
    Regular Coder trib4lmaniac's Avatar
    Join Date
    Feb 2004
    Location
    Cornwall, UK
    Posts
    535
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    Regular Coder
    Join Date
    Oct 2003
    Location
    SC
    Posts
    936
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #5
    New Coder
    Join Date
    May 2004
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation

    Try this script
    Code:
    <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>
    Last edited by JavaScriptdude; 05-08-2004 at 02:03 AM.

  • #6
    Neo
    Neo is offline
    New to the CF scene
    Join Date
    May 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello
    Dear Friend, I saw your code, but what i wanted was the draggable Message, this drages the whole marque across the browser...
    i mean, the position of the Marque May remain the same but the Message of the marquee may be draggable ... is this possible ?

  • #7
    Regular Coder trib4lmaniac's Avatar
    Join Date
    Feb 2004
    Location
    Cornwall, UK
    Posts
    535
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #8
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    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.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #9
    New Coder
    Join Date
    May 2004
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Then you might need to use something else like like a Java applet...

  • #10
    New Coder
    Join Date
    May 2004
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    How about this?
    Code:
    <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>

  • #11
    New Coder
    Join Date
    May 2004
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Did the script work?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •