1

Upon invsetigating 'mu is too short's answer to this question, I noticed that I get different behaviour in jsFiddle than in my local context for the exact same script. Any clues as to why that is?

Note: I am not getting any javascript errors in Firefox's error console in the local context.

UPDATE: I tried grabbing the HTML from fiddle.jshell.net/ambiguous/ZEx6M/1/show/light to a local file and loading that local file in Chromium browser and I got the following errors in the javascript console:

  • GET file:///css/normalize.css undefined (undefined) /css/normalize.css
  • GET file:///css/result-light.css undefined (undefined) /css/result-light.css
  • Resource interpreted as Script but transferred with MIME type application/empty jquery.scrollTo-1.4.2.js:-1
  • Resource interpreted as Script but transferred with MIME type text/plain jquery.viewport.js:-1

I can get rid of these javascript errors by downloading the files and modifying the <script> tags, but it doesn't solve the problem. The page still scrolls down to the very bottom. Also these errors appear even in the working (jsFiddle) version.

I also tried the same process in Konqueror. Result: the script does absolutely nothing.

Community
  • 1
  • 1
Shawn
  • 10,931
  • 18
  • 81
  • 126
  • @mu is too short : Yes, I just tried it and I get the same result (The page calls makeVisibleWhatMust repeatedly until I've scrolled 'till the end) – Shawn Jun 02 '11 at 18:30
  • Nope, no errors in Firefox. In Konqueror, it seems as though the script does nothing at all. I checked that javascript was enabled, so that's not the problem. Also I can't find any error console in Konqueror, where should I look for errors? – Shawn Jun 02 '11 at 19:24
  • I didn't think I had Chrome, but I do! Now I'm getting errors! I'll edit them into my original question. – Shawn Jun 02 '11 at 20:51
  • @mu is too short : That solved the errors, but the page still scrolls down to the very bottom. – Shawn Jun 03 '11 at 14:20
  • Scrolling in any direction triggers the "scroll to the bottom" for me – Shawn Jun 03 '11 at 17:19
  • I think that the scrolling up problem could be an error in my logic. Try with different font-sizes (using Ctrl + and Ctrl -) Is scrolling up still a problem with very small font-sizes? – Shawn Jun 03 '11 at 20:56
  • Thanks for testing.. Anyways, I'm not getting any answers... Even with a bounty! So maybe there's something wrong with my question? What do you think? – Shawn Jun 10 '11 at 18:04
  • @mu is too short : Success! Copying /css/normalize.css locally made it work! More precisely, the `table { border-collapse:collapse; }` instruction seems necessary for the script to work. Any clues as to why? – Shawn Jun 13 '11 at 13:27

1 Answers1

0

Don't use separate files for CSS and javascript. Just bring everything into HTML file (using inline javascript and inline CSS) and you should be OK.

Or, run a web server locally to serve the javascript file (with the correct MIME type) and use relative paths to CSS.

Teddy
  • 18,357
  • 2
  • 30
  • 42
  • Yes, as you can see by the comments of my original question, the difference was due to some CSS added by jsFiddle which I did not have in my local context. – Shawn Jun 14 '11 at 14:32