Class: SectionParallaxWidget

Inherits:
Widget
  • Object
show all
Defined in:
app/models/section_parallax_widget.rb

Instance Method Summary collapse

Instance Method Details

#parallax_speedObject



22
23
24
25
# File 'app/models/section_parallax_widget.rb', line 22

def parallax_speed
  # legacy support for widgets before speed option
  speed.presence || 'medium'
end

#section_classObject



7
8
9
# File 'app/models/section_parallax_widget.rb', line 7

def section_class
  "parallax scrivito_section_parallax_widget section_speed_#{speed}"
end

#section_styleObject



11
12
13
14
15
# File 'app/models/section_parallax_widget.rb', line 11

def section_style
  styles = "height: #{height}; max-height: #{height};"
  styles += "background: url(#{background_image.binary_url}) top center #{'fixed' if speed=='fixed'} no-repeat; z-index: -1;" if !with_parallax? && background_image.present?
  return styles
end

#with_parallax?Boolean

Returns:

  • (Boolean)


17
18
19
20
# File 'app/models/section_parallax_widget.rb', line 17

def with_parallax?
  return true unless speed.present?
  ["slow", "medium", "fast"].include? speed
end