2013-02-27 22 views
5

Sto lavorando attraverso gli esempi nel capitolo 8 del tutorial di Ruby on Rails e sto ricevendo l'errore sopra riportato sulle mie pagine, e il mio menu a discesa non funziona. Qualche idea su come posso risolvere questo problema?Unchaught TypeError: Impossibile leggere la proprietà 'webkit' di undefined

/* =================================================== 
* bootstrap-transition.js v2.0.0 
* http://twitter.github.com/bootstrap/javascript.html#transitions 
* =================================================== 
* Copyright 2012 Twitter, Inc. 
* 
* Licensed under the Apache License, Version 2.0 (the "License"); 
* you may not use this file except in compliance with the License. 
* You may obtain a copy of the License at 
* 
* http://www.apache.org/licenses/LICENSE-2.0 
* 
* Unless required by applicable law or agreed to in writing, software 
* distributed under the License is distributed on an "AS IS" BASIS, 
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
* See the License for the specific language governing permissions and 
* limitations under the License. 
* ========================================================== */ 


!function($) { 

    $(function() { 

    "use strict" 

    /* CSS TRANSITION SUPPORT (https://gist.github.com/373874) 
    * ======================================================= */ 

    $.support.transition = (function() { 
     var thisBody = document.body || document.documentElement 
     , thisStyle = thisBody.style 
     , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined 

     return support && { 
     end: (function() { 
      var transitionEnd = "TransitionEnd" 
      if ($.browser.webkit) { 
Uncaught TypeError: Cannot read property 'webkit' of undefined 
      transitionEnd = "webkitTransitionEnd" 
      } else if ($.browser.mozilla) { 
      transitionEnd = "transitionend" 
      } else if ($.browser.opera) { 
      transitionEnd = "oTransitionEnd" 
      } 
      return transitionEnd 
     }()) 
     } 
    })() 

    }) 

}(window.jQuery); 

risposta

10

Amplia il tuo gioiello bootstrap-Sass alla versione più recente aggiornamento del Gemfile con la linea:

gem 'bootstrap-sass', '~> 2.3.0.1' 

ho avuto problemi ed è stato perché ero in esecuzione la versione 2.0.0 di quel gemma. Non sei sicuro della versione che raccomandano di eseguire nel tutorial, ma l'aggiornamento alla versione più recente non dovrebbe farti male.

+0

Ha funzionato anche per me (dopo aver riavviato il server) – nicolaspanel

13

Il problema penso sia questo qui: $.browser.webkit - apparentemente $ .browser è stato rimosso in jQuery 1.9+.

Secondo this thread non esiste una sostituzione diretta, tuttavia utilizzando this plugin si dovrebbe essere in grado di ripristinare la funzionalità di tale tag.

Problemi correlati