jQuery Error HierarchyRequestError:DOM异常3

时间:2013-06-04 23:50:05

标签: javascript jquery nodes quicksand

我正在使用jQuery quicksand插件并遇到jQuery错误,我完全不明白发生了什么。这是错误“Uncaught Error:HierarchyRequestError:DOM Exception 3”但我知道它与父节点问题有关,但我完全不知道如何修复它。

这是我用来在jQuery Quicksand中过滤我的项目的代码。过滤每隔一段时间就会工作,但它非常奇怪和随机。有时候它会起作用,有时它会隐藏物品,但它们仍会占用空间,因此会留下很多空白区域。有些事情是不对的......我希望我能了解更多信息。

非常感谢任何帮助!谢谢!

<script type="text/javascript">
$(document).ready(function() {
  // 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 $holder = $('ul.ourHolder');

  // clone all items within the pre-assigned $holder element
  var $data = $holder.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
    $holder.quicksand($filteredData, {
      duration: 800,
      easing: 'easeInOutQuad'
    });
    return false;
  });
});
</script>

0 个答案:

没有答案