Uncaught TypeError: jQuery(...).tinyNav is not a function at HTMLDocument.<anonymous> (functions.min.js?ver=4.8.1:6) at i (jquery.js?ver=1.12.4:2) at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2) at Function.ready (jquery.js?ver=1.12.4:2) at HTMLDocument.K (jquery.js?ver=1.12.4:2)
コンソールを見た所、上記のエラーが吐かれていました。
js
1(function($,window,i){$.fn.tinyNav=function(options){var settings=$.extend({'active':'current-menu-item','header':false},options);var counter=-1;return this.each(function(){i++;var $nav=$(this),namespace='tinynav',namespace_i=namespace+i,l_namespace_i='.l_'+namespace_i,$select=$('<select/>').addClass(namespace+' '+namespace_i);if($nav.is('ul,ol')){if(settings.header){$select.append($('<option/>').text('Navigation'))}var options='';$nav.addClass('l_'+namespace_i).find('a').each(function(){options+='<option value="'+$(this).attr('href')+'">';var j;for(j=0;j<$(this).parents('ul, ol').length-1;j++){options+='- '}options+=$(this).text()+'</option>'});$select.append(options);if(!settings.header){$select.find(':eq('+$(l_namespace_i+' li').index($(l_namespace_i+' li.'+settings.active))+')').attr('selected',true)}$select.change(function(){window.location.href=$(this).val()});$(l_namespace_i).after($select);if(settings.label){$select.before($("<label/>").attr("for",namespace_i).addClass(namespace+'_label '+namespace_i+'_label').append(settings.label))}}})}})(jQuery,this,0);jQuery(function(){jQuery('#main-nav .root').tinyNav({active:'current-menu-item'})});
コードは上記のようになっています。
下記の解決策を見る限り jQuery(document);
を使えという話ですが $(document);
は使っていないため、関係なさそうです。
https://stackoverflow.com/questions/7975093/typeerror-undefined-is-not-a-function-evaluating-document
何が問題そうでしょうか...
回答1件
あなたの回答
tips
プレビュー