Liquid Layout and Named Anchors

2 views
Skip to first unread message

Jon B.

unread,
Apr 20, 2009, 10:56:21 AM4/20/09
to iPhoneWebDev
I've been developing an iPhone-optimized version of an existing PHP/
mySQL webapp of mine and have run into an odd problem. I want to be
able to alter the CSS depending on the device orientation. I've
included Joe Hewitt's "liquid layout" [ http://www.joehewitt.com/files/liquid1.html
] and it works great. But if I include a hash in the URL of the page,
the display doesn't jump to the corresponding named anchor. If I
remove the liquid layout eventListener javascipt stuff, then the
display jumps as expected.

Any thoughts on whether and how I can get the page display to jump to
a named anchor on load? Thanks!

Sean Gilligan

unread,
Apr 20, 2009, 6:38:35 PM4/20/09
to iphone...@googlegroups.com
Try removing the lines:

setTimeout(function()
{
window.scrollTo(0, 1);
}, 100);


-- Sean

Jon B.

unread,
Apr 20, 2009, 7:11:32 PM4/20/09
to iPhoneWebDev
Thanks! That did the trick. I was unfamiliar with the scrollto method,
but now that I've researched it, it's obvious that that was the cause
of my issue.

Why is that section of code in there in the first place?

~Jon

Sean Gilligan

unread,
Apr 21, 2009, 9:47:54 PM4/21/09
to iphone...@googlegroups.com
window.scrollTo is used to hide the Navigation bar and show more web content.
The same function is used in iUI (which is essentially a later version of "liquid layout")

Jon B.

unread,
Apr 22, 2009, 7:51:41 AM4/22/09
to iPhoneWebDev
Ahh... Got it. Sometimes there's a hash in the URL and sometimes there
isn't, so I altered that part of the liquid layout to test for it like
so:

if (!window.location.hash) {
setTimeout(function()
{
window.scrollTo(0, 1);
}, 100);
}

Thanks for all the help.

~Jon

Chris Collett

unread,
Apr 22, 2009, 3:15:13 PM4/22/09
to iphone...@googlegroups.com
Good to know......I'll file this one away.

Marc

unread,
May 27, 2009, 5:35:38 PM5/27/09
to iPhoneWebDev
Is there any way around this in iUi? I am experiencing the same
problems where I want to link to an external page with the hashed
anchor, but if I include the hash, the link fails. iUi is much more
complex than Liquid Layout, so I'm unsure of the proper code.

Sean Gilligan

unread,
Jun 2, 2009, 12:11:15 PM6/2/09
to iphone...@googlegroups.com
Marc wrote:
> Is there any way around this in iUi? I am experiencing the same
> problems where I want to link to an external page with the hashed
> anchor, but if I include the hash, the link fails.

The fix is in the trunk and will be released as part of version 0.30.
http://code.google.com/p/iui/issues/detail?id=82

-- Sean

Reply all
Reply to author
Forward
0 new messages