3

Ok I set some images to open up with fancybox. It used to work fine. Now I get 2 errors.

enter image description here

What I changed im not sure. I have read online that you generally get the .fancybox is not a function error message when you have mutiple includes of the jquery library. As far as I am aware I have just the one.

Here is an example of where you can get this error message:

(www).thecardb.com/abarth/1000-Bialbero/1960/0/85

I have done some url rewriting, is it a possibility that that is causing an issue?

RewriteEngine on
RewriteBase /
DirectorySlash Off

# remove trailing slash
RewriteRule ^(.*)\/(\?.*)?$ $1$2 [R=301,L]

# Redirect non-www urls to www
RewriteCond %{HTTP_HOST} ^thecardb\.com [NC]
RewriteRule (.*) http://www.thecardb.com/$1 [R=301,L]

# Don't match real existing files so CSS, scripts, images aren't rewritten
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d

# Match the first two groups before / and send them to the query string
RewriteRule ^([A-Za-z0-9-]+)?$ car.php?model_make_id=$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-._]+)?$ car.php?model_make_id=$1&model_name=$2 [L]

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-._]+)/([0-9]+)?$ car.php?model_make_id=$1&model_name=$2&model_year=$3 [L]

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-._]+)/([0-9]+)/([A-Za-z0-9-._]+)?$ car.php?model_make_id=$1&model_name=$2&model_year=$3&model_trim=$4 [L]

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-._]+)/([0-9]+)/([A-Za-z0-9-._]+)/([0-9]+)?$ car.php?model_make_id=$1&model_name=$2&model_year=$3&model_trim=$4&model_id=$5 [L]

Im lost! Any help is appreciated.

AJFMEDIA
  • 2,093
  • 6
  • 29
  • 52
  • 1
    Are you including jQuery from the CDN? If you are, what url are you using? If you are and are not specifying a version, your jQuery updated to a newer version that doesn't include the `$.browser` method that your version of fancybox appears to be using. – Kevin B Jan 16 '13 at 18:56
  • I am including it from this url http://code.jquery.com/jquery-latest.js ?? – AJFMEDIA Jan 16 '13 at 19:01
  • 1
    http://www.impressivewebs.com/linking-to-jquery/ - Always use a specific version. `jquery-latest.js` isn't minified nor cached. – Andreas Jan 16 '13 at 19:04
  • http://stackoverflow.com/q/14344289/1055987 – JFK Jan 16 '13 at 19:12

2 Answers2

12

jQuery recently upgraded to version 1.9 which removed most if not all of the depreciated methods. $.browser was one of them. Fancybox relies on $.browser, so you can't use jQuery 1.9 and your version of fancybox without the migrate plugin installed. Either downgrade jQuery, upgrade fancybox, or include the migrate plugin.

More information here: http://blog.jquery.com/2013/01/15/jquery-1-9-final-jquery-2-0-beta-migrate-final-released/

You should also always specify a version number.

http://code.jquery.com/jquery-1.8.3.min.js

Kevin B
  • 94,570
  • 16
  • 163
  • 180
  • 1
    My answer updated http://stackoverflow.com/a/14344290/1055987 ... Fancybox v2.1.4 released, which works fine with jQuery v1.9.0 (without the migrate script) – JFK Jan 16 '13 at 19:46
  • Great! Thanks a lot Kevin blog link helps me and it works for me greatly – Dhaval Jan 18 '13 at 16:32
0

You need to change your code:

Find:

$.browser.msie

Replace this with:

navigator.userAgent.match(/msie/i)
Nic
  • 12,220
  • 20
  • 77
  • 105
Nilu Khair
  • 68
  • 1
  • 7