Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nesting JS. Nearly there, but....

Status
Not open for further replies.

GladysPym

Technical User
Jan 6, 2003
76
GB
This is a follow-on from a previously raised thread here:


but the problem has moved on so much that the original title would have been misleading.

My problem:
This site ( is a promotion site for a book. The site graphic is basically the book cover's design (see sgbig.css). So far so good, except that it scrolls on screens less than 800px tall, which is happening more and more, given tablets, netbooks, and such. So I've created a smaller version (sgsmall.cs) and have put in a js call (detect.js) which successfully changes the css file based on the screen size.
This works well enoungh (see but there is a sized peice of js embedded in the html file on some pages (including glyre.html) which needs to change size based on detecting screen size. So I've added

include('scrollsmall.js');

Problem is, it doesn't work. What seems to happen (is the screen size IS bigger than 800) seems to be the larger size from the css file, but with the smaller graphic in it, and no scrolling.

I'm sure this is a simple error, but I'm newish to js, and need a bit of hand-holding. It's just that the site needs to look good, and a bit flashy.

Thanks in advance, guys.
This place is fantastic.

G
 
Look. Leave this for now.
I've just checked it and its a disaster site.
I'll post when I've tidied it up a bit.

SORRY

G
 
OK. Step by step.

1: on my laptop, glyre.html is calling detect.js (there's a js alert).
at doesn't even call detect.js correctly.
So that's the first query.

2: Even when it DOES call the detect.js on my local machine, the scroller doesn't scroll, AND the correct "include(scroll" calls aren't working.

So. Better than a train wreck, but, help?

G
 
Hi

jquery.js is not found on the server, so not loaded, so no JavaScript code which uses jQuery ( including that include() function ) will work.

Beside that, I would make sure all include() calls are inside the [tt]$(document).ready()[/tt]'s callback function. At least as long as they are called from the [tt]head[/tt] section.

Feherke.
 
OK. My bad. It's there now.
And the call works, but the scrollers still don't.


G
 
Hi

That script looks extremely old and uses deprecated practices. I would just give up with that and search the web for a modern one. As you already use jQuery, preferably a jQuery based scroller.


Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top