Resorting ISOtope elements after Search

血红的双手。 提交于 2019-12-11 07:50:30

问题


I'm developing a new Hall of Fame for the Wisconsin Badgers. My beta version is viewable at http://www.uwbadgers.com/athletic-dept/hall-fame-beta.html

My question is, when the search feature is used how do I bring the visible elements to the top. It show the correct elements and uses display:none to hide the others. However it does not re-position the elements after the search and the display:none elements still take up space.

It has to do with the "-webkit-transform" style that isotope uses. How do I go about changing this or is there a better way to search using isotope?

I am using http://lomalogue.com/jquery/quicksearch/ for the search as I could not think of a way to do it with isotope alone.


回答1:


I would use quicksearch's show and hide options to add appropriate classes that can be used for filtering by Isotope

$('input#id_search').quicksearch('div.member', {
  show: function () {
    $(this).addClass('quicksearch-visible');
  },
  hide: function() {
    $(this).removeClass('quicksearch-visible');
  },
  onAfter: function() {
    $container.isotope({ filter: 'quicksearch-visible'});
  }
});


来源:https://stackoverflow.com/questions/6738327/resorting-isotope-elements-after-search

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!