Click to See Complete Forum and Search --> : help with keeping horizontal scroll in place
joananewbie
05-04-2007, 10:47 AM
hello everyone
i´m building my website/portfolio using dreamweaver and basic CSS knowledge. i dont know javascript. But someone told me i needed it to solve my problem :
www.unscratchable.info
its horizontally layed out, as you can check. but when you click on any of the menu items at the end of the row, the scroll automatically comes back to the beginning of the page.
do you know how can i avoid that? how could i freeze my scroll on the moment one clicks the menu button (it works with layers and some visibility properties)
i hope i was clear!
thank you!
joana
PhilDog
05-04-2007, 02:04 PM
Both you and your friend have no Idea what you are doing, if you did, you would know you don't need javascript to fix this.
Your problem is that you are adding are calling an anchor every time you click one of your link. That causes the browser to go search the page for that anchor every time you click the link, and since the browser can't find that anchor, it reverts the scrolling to 0x0.
To fix this problem all you need to do is remove all 52 attributes with a value of "#", by getting rid of every instance of href="#". However, you have no idea how to to that.
I'm going to help you, by telling you to follow these three steps:
Delete your sh*ty site.
Go to www.w3schools.com and learn HTML and CSS.
Rebuild the site from the ground up, in it's current state it isn't worth trying to repair. There are way to many things wrong with it.
Follow those three steps and you'll thank me latter.
joananewbie
05-04-2007, 04:20 PM
wow - are you always this violent when helping people?
if i knew html and css do you think i would come to a forum naming myself as a newbie and starting by saying "i dont know much of this, can you help"?
your link is very interesting, but its too complex for me to understand how it can be of any help to my specific situation.
erasing the site and starting from scrach seems to me a hasteful solution, just wasting time and energy - do the rest of the people reading this also agree i should just start from scratch?????
thank you for the explanation on the anchors, but maybe you could just let me know how i could stop it from going to 0,0 every time an anchor is clicked.
anyway, thank you for your time and your link.
joana
PhilDog
05-04-2007, 11:10 PM
That's the thing, there is none. There is no way to stop it from happening, other then removing all 52 instances of href="#".
The reason I am telling you to get rid of it is because it is very poorly coded. The underling design is beautiful, but the code is sh*t. You could create some interesting designs
w3schools is a little complex for nubies, but that is what I learned off of. I would recommend you go to http://htmldog.com/ instead, many people like it, I don't, so I'm betting you would. I'm weird like that.
David Harrison
05-05-2007, 10:47 AM
A simplified version of the code:<a href="#" onclick="someFunction();">Some Text</a>And here's a quick way to "fix" the problem:<a href="#" onclick="someFunction();return false;">Some Text</a>The return false means that after the browser has finished running someFunction() it will then stop, and not carry out the default action of the link, so it will not jump to the top of the page.
However, that doesn't fix the other problem, which is that the page simply won't work for people who do not have JavaScript enabled, or for those who cannot enable it. The number of people without JavaScript enabled tends to vary based on who's statistics you use, however the average seems to be that about 10% of surfers, do it without JavaScript. Which means that 1 in 10 people will not be able to see the content that only appears when running:MM_changeProp('blog','','style.visibility','visible','LAYER')What you could do however, is create pages for each of those appearing content areas, and link to them. But then block JavaScript enabled users from following the link and run the function instead. Something like the following:<a href="somePage.html" onclick="someFunction();return false;">Some Text</a>So non-JavaScript users go to somePage.html, while JavaScript users run the someFunction() which reveals the content on the same page. That would allow you to have the same menu as you have now, and allow more users access to your content.
Oh and if you want to learn HTML, CSS and JavaScript, don't do it from a website. HTML dog is ... tragic and W3C Schools gets a lot wrong or is incomplete. Dead tree is still the best way to go, and it's how I learned HTML and CSS. I bought one of Elizabeth Castro's books, and it was pretty damn good, which is why I'd recommend getting this (http://www.cookwood.com/html6ed/) to learn from.