|
-
Sep 23rd, 2004, 02:04 AM
#1
Thread Starter
Hyperactive Member
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.
-
Sep 23rd, 2004, 06:06 AM
#2
Frenzied Member
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 menuLeft= 5;
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.
-
Sep 23rd, 2004, 06:08 AM
#3
Frenzied Member
Magiaus
If I helped give me some points.
-
Sep 23rd, 2004, 07:35 AM
#4
Thread Starter
Hyperactive Member
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.
-
Sep 24th, 2004, 12:52 AM
#5
Thread Starter
Hyperactive Member
Hey, no one knows how to add this java to asp .net and atach to dynamicaly created control?
Help me, please!
-
Sep 24th, 2004, 07:12 AM
#6
I wonder how many charact
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:
Dim myjavacode As String = "<script>function (...... </script>"
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.
-
Sep 24th, 2004, 07:43 AM
#7
Thread Starter
Hyperactive Member
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.
-
Sep 24th, 2004, 10:28 AM
#8
I wonder how many charact
Code:
<body id="Body1" runat="server">
VB Code:
Protected Withevents Body1 As System.Web.Ui.HtmlControls.HtmlGenericControl
Private Page_Load
Body1.Attributes.Add("onScroll","callmyJavaFunction();")
End Sub
-
Sep 24th, 2004, 01:55 PM
#9
Frenzied Member
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.
-
Sep 27th, 2004, 12:52 AM
#10
Thread Starter
Hyperactive Member
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?
-
Sep 27th, 2004, 01:40 AM
#11
Frenzied Member
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">
<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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|