jquery - using quicksand plugin to get specific data -
can me quicksand plugin, trying load web data-value first not data-value loaded on pageload.the idea when click on drop down menu instance web design web.html has web projects loaded not value under default.this html: thanks!
<div id="smoothmenu1" class="ddsmoothmenu"> <ul> <li>home</li> <li>design <ul> <li>web design</li> <li>banners</li> <li>posters</li> </ul> </li> <li>video< <ul> <li>category 1</li> <li>category 2</li> <li>category 3</li> </ul> </li> <li>games</li> <li>contact</li> </ul> <ul id="content" class="gallerynav"> <li class="selected-1 button2">< data-value="all">all</li> <li class="button2">< data-value="web">web design</li> <li class="button2">< data-value="photo">banners</li> <li class="button2">< data-value="video">posters</li>
<ul id="gallery" class="qsmall"> <li data-id="id-1" class="web"> <span class="qcaption peek"> <span class="meta"> <span class="name">om du möter varg</span></span> <a href rel="zoombox[web]" title="om du möter varg"> </a></li></ul>
and on.
, javascript file:
$(function() { var read_button = function(class_names) { var r = { selected: false, type: 0 }; (var i=0; < class_names.length; i++) { if (class_names[i].indexof('selected-') == 0) { r.selected = true; } if (class_names[i].indexof('segment-') == 0) { r.segment = class_names[i].split('-')[1]; } }; return r; }; var determine_sort = function($buttons) { var $selected = $buttons.parent().filter('[class*="selected-"]'); return $selected.find('a').attr('data-value'); }; var determine_kind = function($buttons) { var $selected = $buttons.parent().filter('[class*="selected-"]'); return $selected.find('a').attr('data-value'); }; var $preferences = { duration: 800, easing: 'easeinoutquad', adjustheight: false }; var $list = $('#gallery'); var $data = $list.clone(); var $controls = $('ul.gallerynav'); $controls.each(function(i) { var $control = $(this); var $buttons = $control.find('a'); $buttons.bind('click', function(e) { var $button = $(this); var $button_container = $button.parent(); var button_properties = read_button($button_container.attr('class').split(' ')); var selected = button_properties.selected; var button_segment = button_properties.segment; if (!selected) { $buttons.parent().removeclass('selected-1'); $button_container.addclass('selected-' + 1); var sorting_type = determine_sort($controls.eq(1).find('a')); var sorting_kind = determine_kind($controls.eq(0).find('a')); if (sorting_kind == 'all') { var $filtered_data = $data.find('li'); } else { var $filtered_data = $data.find('li.' + sorting_kind); } if (sorting_type == 'size') { var $sorted_data = $filtered_data.sorted({ by: function(v) { return parsefloat($(v).find('span').text()); } }); } else { var $sorted_data = $filtered_data.sorted({ by: function(v) { return $(v).find('strong').text().tolowercase(); } }); } $list.quicksand($sorted_data, { enhancement: function() { zoombox.init(); } }, function() { $('.qcaption.peek').hover(function(){ $(".cover", this).stop().animate({top:'25px'},{queue:false,duration:160}); }, function() { $(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160}); }); });
}
e.preventdefault(); });
});
});
this did:
<script type="text/javascript"> $(document).ready(function() { $(".class").trigger('click'); }); </script>
it's not best solution worked me. .class has class of link you'll replicate trigger. way fake click on anchor when load page make quicksand believe clicked there.
Comments
Post a Comment