jquery - Is there a way to animate display:none? -
i filtering divs based on selection dropdown menus, keeps divs selected value visible , else gets css attribute display:none; there way animate it's not such harsh transition?
jquery
$(function(){ $("#map-date, #map-type, #map-county").change(function (){ var filters = $(this).val(); $("div.map-thumb").css({"display":"none"}); $("div[class*='" + filters + "']").show(); }); });
haml
.row#map-thumbnail-wrapper .medium-4.columns %select#map-type %option.filter{value: "all"} type of program - mapchoices['program'].each |program| %option.filter{value: program.downcase.gsub(' ', '-')}= link_to program, '#' .medium-4.columns %select#map-date %option.filter{value: "all"} date constructed - [*2007..date.today.year].each |year| %option.filter{value: year}= year .medium-4.columns %select#map-county %option.filter{value: "all"} county - current_locations = @cms_page.children.published.map { |i| cms_page_content(:county, i).capitalize }.keep_if(&:present?).uniq.sort - current_locations.each |county| %option.filter{value: county.downcase.gsub(' ', '-')}= link_to county, '#' .well-thumbnails - @cms_page.children.published.in_groups_of(6, false) |location_row| .row - location_row.each |location| .medium-2.columns - date_created = cms_page_content(:date_created, location) .map-thumb.all{class: "#{cms_page_content(:program, location).downcase.gsub(' ', '-')} #{datetime.parse(date_created).strftime('%y') if date_created.present?} #{cms_page_content(:county, location).downcase}"} - preview_image = cms_page_content('preview.image', location) = link_to image_tag(preview_image.file.url(:original)), location.full_path if preview_image .map-yellow .map-align-mid .thumb-text-wrapper = cms_page_content(:name, location)
the standard way fade out (aka opacity = 0) once animation has completed use display none. once want return make display type visible fade in (opacity = 1).
Comments
Post a Comment