大佬教程收集整理的这篇文章主要介绍了当我在这个函数中使用scrollTo jQuery插件时,我得到一个`无法读取属性’切片’的undefined`消息,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我在JS控制台中收到此错误:
16827Uncaught TypeError: CAnnot read property 'slice' of undefined d.fn.scrollToindex.html.js:16827 jQuery.extend.eachindex.html.js:662 d.fn.scrollToindex.html.js:16827 jQuery.extend.eachindex.html.js:662 jQuery.fn.jQuery.eachindex.html.js:276 d.fn.scrollToindex.html.js:16827 popupPlaceindex.html.js:18034 (anonymous function)index.html.js:17745 jQuery.extend._Deferred.deferred.resolveWithindex.html.js:1018 doneindex.html.js:7247 jQuery.ajaxTransport.send.script.onload.script.onreadystatechange
当我放置$(“.menu”).scrollTo($(“li.matched”).attr(“id”),800);在里面.
function popupPlace(Dict) { $popup = $('div#dish-popup'); $popup.render(Dict,window.dishPopupTemplatE); if(typeof(Dict.dish) === 'undefined') { $popup.addClass('place-only'); } else { $popup.removeClass('place-only'); } var $place = $('div#dish-popup div.place'); var place_id = Dict.place._id; if(liked[place_id]) { $place.addClass('liked'); } else { $place.removeClass('liked'); } if(Dict.place.likes) { $place.addClass('has-likes'); } else { $place.addClass('zero-likes'); } var tokens = window.currentSearchTermTokens; var tokenRegex = tokens && new RegExp($.map(tokens,RegExp.escapE).join('|'),'gi'); $.each(Dict.place.products,function(n,product) { $product = $('#menu-item-'+product.id); if(liked[place_id+'/'+product.id]) { $product.addClass('liked'); } if(tokens && matchesDish(product,tokens)) { $product.addClass('matched'); $product.highlight(tokenRegeX); } else { $product.removeClass('matched'); $product.removeHighlight(); } if(product.likes) { $product.addClass('has-likes'); } else { $product.addClass('zero-likes'); } }); $('#overlay').show(); $('#dish-popup-container').show(); // Scroll to matched dish //$("a#scrolll").attr("href","#" + $("li.matched").attr("id")); //$("a#scrolll").attr("href","#" + $("li.matched").attr("id")); //$("a#scrolll").trigger("click"); $(".menu").scrollTo( $("li.matched").attr("id"),800 ); // Hide dish results on mobile devices to prevent having a blank space at the bottom of the site if (Modernizr.mq('only screen and (max-width: 640pX)')) { $('ol.results').hide(); } $(".close-dish-popup").click(function() { $("#overlay").hide(); $("#dish-popup-container").hide(); $('ol.results').show(); changeState({},['dish','place','serp']); }); showPopupMap(Dict.place,"dish-popup-map"); }
有什么建议来解决这个问题吗?
以上是大佬教程为你收集整理的当我在这个函数中使用scrollTo jQuery插件时,我得到一个`无法读取属性’切片’的undefined`消息全部内容,希望文章能够帮你解决当我在这个函数中使用scrollTo jQuery插件时,我得到一个`无法读取属性’切片’的undefined`消息所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。