Results 1 to 11 of 11

Thread: Flying tree meniu

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2000
    Location
    Europe, Lithuania
    Posts
    309

    Resolved Flying tree meniu

    Hello,

    I have dynamic tree menu, which scrolls when page is scrolling.

    Problem is, that when I used asp and html frames I got menu (links with java) in left side of page, which do not scroll, when page content scrolls (because it was in another frame).

    Now I use ASP .NET, and my tree menu is user control.
    There are no frames. If content consist large amount of data, and user scroll to the end of the page, tree menu becomes invisible (it stays in top-left). When I used frames, it does not change its top position, when scrolling.

    I quest you understood my problem.

    What solution could be?
    Please help.
    Last edited by Norkis; Oct 5th, 2004 at 01:37 AM.

  2. #2
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    hmm a quest......

    I bid you must quest for the evil javascript that uses dhtml to move an object.

    maybe something like this

    PHP Code:
    <SCRIPT LANGUAGE=JAVASCRIPT>
        <!--
            function 
    ScrollMenu()


                {
                var 
    menuLeft5;
                var 
    menuTop 10;
                var 
    scrollDelay 100;
                if (
    document.all.menu.style.pixelLeft document.body.scrollLeft menuLeft)


                        {
                    
    document.all.menu.style.pixelLeft++;
                    
    setTimeout('ScrollMenu()'scrollDelay);
                }
                else if (
    document.all.menu.style.pixelTop document.body.scrollTop menuTop)


                    {
                    
    document.all.menu.style.pixelTop++;
                    
    setTimeout('ScrollMenu()'scrollDelay);
            }
            else if (
    document.all.menu.style.pixelLeft document.body.scrollLeft menuLeft)


                    {
                
    document.all.menu.style.pixelLeft--;
                
    setTimeout('ScrollMenu()'scrollDelay);
            }
            else if (
    document.all.menu.style.pixelTop document.body.scrollTop menuTop)


                    {
                    
    document.all.menu.style.pixelTop--;
                
    setTimeout('ScrollMenu()'scrollDelay);
            }
        }
            
    //-->
            
    </SCRIPT
    and maybe you could use RegisterClientScriptBlock to load it and then init it with RegisterStartupScript

    I have quested
    Magiaus

    If I helped give me some points.

  3. #3

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2000
    Location
    Europe, Lithuania
    Posts
    309
    Thanks. This code is great.

    Now I must include this code into my project and to make it work.
    Can you help me?

    I haven't work with java and asp .net.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2000
    Location
    Europe, Lithuania
    Posts
    309
    Hey, no one knows how to add this java to asp .net and atach to dynamicaly created control?

    Help me, please!

  6. #6
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Magius told ya how, or at least directed how to do it...
    "and maybe you could use RegisterClientScriptBlock to load it and then init it with RegisterStartupScript"

    put it in your Page_PreRender method...
    VB Code:
    1. Dim myjavacode As String = "<script>function (......  </script>"
    2. Page.RegisterClientScriptBlock("test", myjavacode)

    Or you could just manually add it to a script file, and include a reference to it in your code manually.

    But really why do you need a floating menu?

    If you seperate your menu and main (overflowing) content in divs, then you don't need javascript at all. The main content goes in to a div with style of overflow-y set to a realistic height of say 450px.

    Now, obviously the menu doesn't need to float down to where you are, but the page itself is not longer than the screen height -- so you don't need it to.
    Last edited by nemaroller; Sep 24th, 2004 at 07:24 AM.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2000
    Location
    Europe, Lithuania
    Posts
    309
    Thanks nemaroller for your advice.

    I know, how to load script, but I do not know how attach Onscroll atributte to body?

    That script load with user control and I do not know how to access to parent page body.

    Do not use floating menu would be great, but I do not really understood what should I do.

    I hopply asking you to create simple html, where could I see your suggestion.

  8. #8
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Code:
    <body id="Body1" runat="server">

    VB Code:
    1. Protected Withevents Body1 As System.Web.Ui.HtmlControls.HtmlGenericControl
    2.  
    3. Private Page_Load
    4.  Body1.Attributes.Add("onScroll","callmyJavaFunction();")
    5. End Sub

  9. #9
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    Sorry I couldn't give a better example Norkis. I'm pretty caught in my problems right now. My boss is talking about having me for bbq.
    Magiaus

    If I helped give me some points.

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2000
    Location
    Europe, Lithuania
    Posts
    309
    nemaroller, your code works only in aspx page.
    What to do if this code is placed in user control, which can't have body in html?

  11. #11
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    You actualy don't need to use the body tag. If you look up the javascript setTimeoutand setInterval you will see that you can actualy just set the script to be called every few milliseconds and it will check to see if it needs to move the menu.

    just use the script i posted and make 1 call to setTimeout("ScrollMenu()", 100) that will init the proc and it will run from then on at a timed interval.

    here is an example of setTimeout

    Code:
    <HEAD>
    <SCRIPT language="JavaScript">
    <!--hide
    function newtext()
    {
      document.myform.mytext.value="Hey! I have changed!";
      setTimeout("moretext()",1000);
     }
    function moretext()
    {
      document.myform.mytext.value="I just change with the time!";
    }
    
    //-->
    </SCRIPT>
    </HEAD>
    
    <BODY>
    <FORM name="myform">
    <INPUT type="text" name="mytext" value="Not Much Here." size="30">
    &nbsp;&nbsp;
    <INPUT TYPE="button" name="but1" value="Click!" onClick="newtext()">
    </FORM>
    Magiaus

    If I helped give me some points.

Posting Permissions

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



Click Here to Expand Forum to Full Width