AndaleTheGreat Posted August 24, 2009 Report Posted August 24, 2009 I have a nice looking menu i found, but the java for it refers it to a deprecated term. it uses 'value' in the tag. Can I replace this in a simple fashion? It's not necessary so I'm willing to just remove the value from the tag and leave the java be. I also wanted to know if the 'value' of value can be changed by clicking a link in that line without loading a new page. I have an idea that involves multiple DIVs and INCludes but it seems too complicated to work. the html VEGGIE FRUIT the line of code var c,v; c=e[i]; v=c.value; if(v==1){s=c; w=c.offsetWidth; p=c.offsetLeft} the full script var menuSlider=function(){ var m,e,g,s,q,i; e=[]; q=8; i=8; return{ init:function(j,k){ m=document.getElementById(j); e=m.getElementsByTagName('li'); var i,l,w,p; i=0; l=e.length; for(i;i var c,v; c=e[i]; v=c.value; if(v==1){s=c; w=c.offsetWidth; p=c.offsetLeft} c.onmouseover=function(){menuSlider.mo(this)}; c.onmouseout=function(){menuSlider.mo(s)}; } g=document.getElementById(k); g.style.width=w+'px'; g.style.left=p+'px'; }, mo:function(d){ clearInterval(m.tm); var el,ew; el=parseInt(d.offsetLeft); ew=parseInt(d.offsetWidth); m.tm=setInterval(function(){menuSlider.mv(el,ew)},i); }, mv:function(el,ew){ var l,w; l=parseInt(g.offsetLeft); w=parseInt(g.offsetWidth); if(l!=el||w!=ew){ if(l!=el){var ld,lr,li; ld=(l>el)?-1:1; lr=Math.abs(el-l); li=(lr if(w!=ew){var wd,wr,wi; wd=(w>ew)?-1:1; wr=Math.abs(ew-w); wi=(wr }else{clearInterval(m.tm)} }};}(); Quote
AndaleTheGreat Posted August 24, 2009 Author Report Posted August 24, 2009 It's not necessary so I'm willing to just remove the value from the tag... seems i didn't realize, if i remove the value then all my divs are exposed at once, so that won't do. Quote
AndaleTheGreat Posted October 2, 2009 Author Report Posted October 2, 2009 I'd still like to find out how to make the java look at some other value. I changed the original setup of this NavBar to show a DIV when clicked instead of changing pages. This means I'm not reloading the page and therefore not able to simple change value="1" to another I had an idea but don't know how to implement it. Solutions: I could use onload to set the HOME value to 1. I could use onclick to change the value (which I realize is deprecated, but noone has had a solution to that issue either) to 1. Problems: onload not available for I don't know how to correctly implement onclick events at all how would I devalue the other s Quote
BeeDev Posted October 2, 2009 Report Posted October 2, 2009 What are you trying to do? Perhaps show me an example/online page so that I can see. Why do you need to store values to ? You can't use ID or Class when you want to store "1" because ID and Class cannot start with numbers. onload is not available to anything except tag because its called when the page finishes loading, not one element. However you can use onload to fire a function that can manipulate the 's Show me an example/online page then we can start from there. Quote
AndaleTheGreat Posted October 2, 2009 Author Report Posted October 2, 2009 sorry, i forget that i don't have that in my sig on this forum testsite dot daybreakphotography dot org the value of one on the line marks the springback point of the 'slide' in the navbar Quote
BeeDev Posted October 5, 2009 Report Posted October 5, 2009 Ok so I see that you're trying to make an animated menu? What you're trying to achieve can be implemented very easily using jQuery and a plugin for it called LavaLamp. You can read a very good tutorial on how to implement it on the following page: http://www .gmarwaha .com/blog/2007/08/23/lavalamp-for-jquery-lovers/ The second example down the page is perhaps exactly identical to what you're trying to do. This menu doesn't use "value" attribute and it should pass validation. Have a look and try to implement it, and if you need help or stuck on something then post it here. Quote
AndaleTheGreat Posted October 6, 2009 Author Report Posted October 6, 2009 great advice BeeDev everything worked out great in the end it took me a few hours cuz 1 thing after another would surprise me, turns out my biggest issue was things with the same name. Now my only issue is trying to move the text into center of photo Quote
BeeDev Posted October 6, 2009 Report Posted October 6, 2009 I see that you've implemented Lavalamp already Nice one, and glad I could help. You've got 1 Javascript error, from one of the Quote
AndaleTheGreat Posted October 6, 2009 Author Report Posted October 6, 2009 yah, i forgot to upload my last change to remove that script last night. I could get it to work anyway. oh yah, the second i saw how it was implemented i knew i would use it. my problem before was that I couldn't create a value change (since I don't really know .js at all). It works perfectly with my hidden DIVs setup. All that's really left is to stop screwing around with little stuff and clean it up so everything has actual links and not '/css/style.css' Also, I can't get it to stop downloading the larger versions of photos I have linked, but that's for another topic area Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.