我遇到了“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'});”

知道需要做什么吗?

最佳答案

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

关于javascript - Jquery: Uncaught TypeError: Object #<Object> 没有方法 'quicksand',我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10338513/

10-12 06:40