【问题标题】:Jquery: Uncaught TypeError: Object #<Object> has no method 'quicksand'Jquery: Uncaught TypeError: Object #<Object> has no method 'quicksand'
【发布时间】:2012-04-26 17:35:20
【问题描述】:

我遇到了“Uncaught TypeError: Object # has no method 'quicksand'”的异常,我似乎无法找到错误的来源。我对 jQuery 和 Java Script 很陌生,不知道出了什么问题。

我在这里尝试实现示例:http://www.evoluted.net/thinktank/web-development/jquery-quicksand-tutorial-filtering

我拿了那个代码,我运行了索引文件,我可以看到它工作正常,所以我只是复制了列表并取了他的 main.js 内容,并与我已经获得这个功能的那个结合起来:

$(document).ready(function () { 
$("#myController").jFlow({ controller: ".jFlowControl", slideWrapper: "#jFlowSlider", slides: "#mySlides", selectedWrapper: "jFlowSelected", width: "960px", height: "350px", duration: 400, prev: ".jFlowPrev", next: ".jFlowNext", auto: true }); 
$().UItoTop({ easingType: 'easeOutQuart' }); jQuery("a[data-gal^='prettyPhoto']").prettyPhoto({ social_tools: false });
 // get the action filter option item on page load
  var $filterType = $('#filterOptions li.active a').attr('class');
  // get and assign the ourHolder element to the
    // $holder varible for use later
  var $dataholder = $('ul.ourHolder');

  // clone all items within the pre-assigned $holder element
  var $data = $dataholder.clone();

  // attempt to call Quicksand when a filter option
    // item is clicked
    $('#filterOptions li a').click(function(e) {
        // reset the active class on all the buttons
        $('#filterOptions li').removeClass('active');

        // assign the class of the clicked filter option
        // element to our $filterType variable
        var $filterType = $(this).attr('class');
        $(this).parent().addClass('active');

        if ($filterType == 'all') {
            // assign all li items to the $filteredData var when
            // the 'All' filter option is clicked
            var $filteredData = $data.find('li');
        } 
        else {
            // find all li elements that have our required $filterType
            // values for the data-type element
            var $filteredData = $data.find('li[data-type=' + $filterType + ']');
        }

        // call quicksand and assign transition parameters
        $dataholder.quicksand($filteredData, {
            duration: 800,
            easing: 'easeInOutQuad',
            attribute: "data-id",
        });
        return false;
    });
    }
);

" 但我收到一个错误:“$dataholder.quicksand($filteredData,duration: 800,easing: 'easeInOutQuad'});”

知道需要做什么吗?

【问题讨论】:

  • 您是否正确包含了quicksand 插件?
  • 我的 PHP 文件中有以下内容,并且路径正确:
  • link是jQuery.min.js的来源
  • 确认$dataholder 包含元素。 alert($dataholder.length)
  • 如果出现错误,这意味着页面中没有正确包含流沙插件,或者您包含了两次 jQuery。

标签: javascript jquery


【解决方案1】:

包含 jQuery 的第二个副本会导致前一个副本和所有插件被覆盖。删除其中一个可以解决问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多