1

I just started working on the following site: http://www.psykotaktyle.com/

I have downloaded the latest jQuery (1.6.2) and jQuery UI (1.8.14).

The only other JS code on the page is:

function get_url_param(param, url) {
  param = param.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+param+"=([^&#]*)";
  var regex = new RegExp(regexS);
  var results = regex.exec(url);
  if( results == null )
    return '';
  else
    return results[1];
}

$(document).ready(function() {
  $('ul.menu li').click(function() {
    var href = $('a', this).attr('href');
    var content = get_url_param('page', href);
    if (!content) content = 'home';

    $('.slide-item').animate({top:'1000px'}, 500)

    //$('#content').fadeOut();

    //alert(content);

    return false;
  });
});

For some reason I get a JS error on the page when clicking on a menuitem.

Uncaught TypeError: Not enough arguments jQuery-1.6.2.min.js:18

I don't have a clue what went wrong here so I hope someone can tell me what is causing this error.

PeeHaa
  • 71,436
  • 58
  • 190
  • 262
  • 1
    Instead of min.js version use full version and then you can easily see what is wrong - even if it is in jquery code. – pajton Aug 04 '11 at 21:05
  • you're missing one semi-colon + the brackets at the ifs. – jackJoe Aug 04 '11 at 21:07
  • 2
    I'm not getting a javascript error on your site...I tried in IE, Chrome, and FF. The only thing I can see wrong in the above code is that you're missing a semi-colon for the line with the call to animate. – RoccoC5 Aug 04 '11 at 21:09
  • @jackJoe: semi-colons are optional in JS and it's an one-line if statement – PeeHaa Aug 04 '11 at 21:22
  • 1
    Probably not the source of your troubles, but this regex method of parsing parameters from query strings is broken in multiple ways. Instead, grab `this.search` from the link to get the query string on its own without the rest of the URL, `slice(1)` to lose the question mark, then split on `/[&;]/` to get an array of key/value pairs, split each on `'='` and `decodeURIComponent()` the key and the value before testing for equality and returning the value. – bobince Aug 04 '11 at 21:25
  • @bobince: You can score some bonus points if you post some example code of that @ http://stackoverflow.com/questions/6948053/is-this-javascript-code-safe :-) – PeeHaa Aug 04 '11 at 21:29

2 Answers2

3

Just ran into this same problem and it is Chrome related. Error is occurring with the combination of the current Chrome Canary Channel (15), jQuery 1.6.2, and an animation call.

scasmflop
  • 31
  • 3
  • 1
    Yup had the same problem when I noticed my site suddenly started throwing jQuery errors in Canary. Updated it to 15.0.846.0 and it's all peachy now. – Gautam Aug 06 '11 at 16:05
2

Nothing wrong with that code. It's working

Check this fiddle.

http://jsfiddle.net/3TDch/

JUST realized :-) Add position:absolute; to your slider-item.

EDIT BY OP

Sorry to hijack your answer avetarman :)

The issue was indeed the latest Chrome version (v15).

I've just tested with v12 and it works.

PeeHaa
  • 71,436
  • 58
  • 190
  • 262
avetarman
  • 1,244
  • 9
  • 8
  • Hmmmm... looks like the update of Chrome 10 minutes ago is the culprit! And thanks for testing + the absolute positioning. – PeeHaa Aug 04 '11 at 21:14