PDA

View Full Version : How can the positioning be controlled with Jim's DHTML Menu?



PeterD
01-22-2009, 01:54 PM
1) Script Title:
Jimís DHTML Menu v5.7

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex1/jimmenu/index.htm

3) Describe problem:

Positioning - controllable? (E.g. below logo.)
Maybe another script would be easiest - but is there any way that the positioning of Jim's menu can be controlled?

I've looked at past posts, but seems there's no soln so far.

About another script, any recommendations?

I mean, must be cascading menu, must be able to control positioning, e.g. below logo, mainly I use horizontal bar, but an option for a vertical block also, would be close to a mandatory feature.

Thanks for any help, best wishes, Peter D.

PeterD
01-22-2009, 06:12 PM
In the Javascript functions for this Menu system, there are numerous references to the style/css attribute/value pair:

...position = "absolute"

Changing "most" of these to "relative" seems to be the begining of controlling the position.

Probably "float" (e.g. float: left) will come into it also, probably "clear" also.

I expect "left", and "top" will also come into it.

At the moment I have the "components" of the menus positioned inside my own "div", under my logo, but those components are "scattered", e.g. "some appear as if on a stairway", and some are "underneath", etc.

This is due to my lack of control, and lack of completeness, regarding those css attributes mentioned above, and in turn due to my incomplete implementation/modification of the javascript functions and scripts.

I think its worthwhile persevering for a while longer, e.g. to hone my skills, but I have found a commerical product that looks promising, and is quite inexpensive and would save time - but any suggestions/comments, e.g. on coding, or on alternative cascading Menus sytems would be very welcomed.

If my coding doesn't work out I'll probably try HV or Top Bar III from DD as my next step - and before going ahead I'll research the DD forum first, for any problems or advantages.

PeterD.

PeterD
01-23-2009, 07:35 AM
(1)
I'd like to do this, I think it would be the best way, but I can't manage it yet:
Put the menu inside a div, use css positioning/clear/float, etc, for that div - so that the "absolute" positioning of the menu is then relative to that containing div
* I've not succeeded as yet
* any thoughts on this approach and on how to achieve it?
* I belive this approach, if successful, leaves Jim's Menu code as is

(2)
One approach that works right now is the following, maybe very effective, but I believe (1) above would be better :
* When, inside the unit() function (inside the config.js file), you create the first new (horizontal) menu, by calling
menus[0] = new menu(parameter list)
* Then:
- Feed in parameters 3 and 4, for horizontal co-ord and vertical co-ord of the Menu position
- But base these parameters on your window size, etc, somehow accounting for resolution effects, and if possible, based also on the the height (and width) of your logo etc

e.g. insider init()
menus[0] = new menu(1st parameter, 2nd parameter, 100, 200, remaining parameters);

will position the menu 100 (pixels) from the left of your window/screen, and 200 pixels from the top of your window/screen - and everything else falls into place

So if we can feed in the correct parameter values, based on some JavaScript code to measure and get the parameters values we need - then we should be ok to position the menu.

Any suggestions please on how I can measure my existing content - maybe the position of a <hr/> I'm using just above where I want the menus.

I think:
<script type="text/javascript">
myFirstMeasurement = find the position of the <hr/> (in pixels)
myFirstMeaurement = getElementById('myIDForThisHr').style.position
or use ....style.top

myVerticalPosition = the vertical co-ord for my menu
myVerticalPosition = myFirstMeaurement + 10
maybe need + "px" also
</script>

Then feed this parameter value, plus the parmeter value for menu position from the "left", into the init() function
- menu[0] = new menu(parameter list, including the above two parameters in their correct position)

Any coments/suggestions/assistance please, would be welcomed.

PeterD
01-23-2009, 01:32 PM
Unless I can "get" a measurement/value from the top of my window to some DOM object, say the <hr/> under my logo - that's a (variable) measurement which is (returned) true (from a JavaScript function) for each browser and resolution, as these vary, then...

I'm dropping Jim's DHTML Menu for now - because I can't easily position it, say within a div, so that it just flows onto my page where I want it, under my logo etc, and regardless of the particular browser and resolution.

I find having to use specific pixel sizes to position the Menu is totally unsatisfactory.

If there is a soln to this positioning problem, then I'm very happy with the rest of the Menu.

I'm now going to investigate and test another cascading menu from DD.

PeterD
01-23-2009, 03:53 PM
Perfect soln:

From my perspective as relative novice, the best soln for me was to use an alternative menu.

I found this one from DD brilliant, and suits me exactly, with no positioning problems:

All Levels Navigational Menu (v2.1)