0

I was doing some debugging of a site in Firefox 3.6.21 using Firebug 1.7.3. When the page first loads, the Javascript I am trying to execute doesn't load at all. I open up Firebug to see what the problem is, I hit reload, and all of a sudden it's working.

I have no idea what is going on here.

function initStations() {
  //console.log("in stations")
  ringContainer = $("#ringContainer");
  ringWidth = ringHeight = ringContainer.innerWidth();
  //console.log(ringWidth + " " + ringHeight);
  originX = (ringWidth / 2) - 0;
  originY = (ringHeight / 2);
  radius = originY + 20;
  //console.log(originX + " " + originY + " " + radius);
  // get the ul containing the stations
  stationList = $("#stationList");
  // an array of the li elements
  stationLiElems = $("#stationList li");
  // how many stations
  length = stationLiElems.size();
  // distance between stations in degrees
  spacing = (360 / length)
  // 360 degrees in circle divided by the number of stations
  // array of stations
  stations = [];
  // debug
  //console.log(stationList);
  stationLiElems.each(function(index, element) {
  //console.log(index +" - "+ spacing);
  stations[index] = {
    'element' : element,
    // http://stackoverflow.com/questions/925118/algorithm-for-finding-out-pixel-coordinates-on-a-circumference-of-a-circle
    'x' : originX + radius * Math.sin(spacing * index * 0.0174532925 ),
    'y' : originY + radius * Math.cos(spacing * index * 0.0174532925 )
  }
  $(element).css({'top' : stations[index].y , 'left' : stations[index].x });
});
dda
  • 6,030
  • 2
  • 25
  • 34
Stewarty
  • 163
  • 1
  • 7
  • Is that function even being entered? Or is the failure earlier than that? With Firebug disabled, what are the errors in the error console? – Boris Zbarsky May 30 '12 at 14:39
  • 1) Can you test in different browsers and compare (Chrome, Opera, IE)? 2) Can you test on a separate Firefox profile and compare? (run `firefox.exe -P` from command line; create new profile, install Firebug, launch the page) – jakub.g May 30 '12 at 22:37

1 Answers1

0

Had this same issue, and removing console.log fixed it for me. I see you have commented it out, but check you aren't using it elsewhere.

Graham
  • 323
  • 1
  • 4
  • 8