Skip to content

Instantly share code, notes, and snippets.

@pzi
Created April 29, 2016 07:28
Show Gist options
  • Save pzi/aea4fbb664f283abcf077d48b913364e to your computer and use it in GitHub Desktop.
Save pzi/aea4fbb664f283abcf077d48b913364e to your computer and use it in GitHub Desktop.
Use cycle2 with progressive loading in Haml
.cycle-slideshow.auto{data: { cycle_loader: true, cycle_progressive: "#slideshow-images" }}
-# default image loaded
= image_tag "image0.jpg", alt: ""
%script#slideshow-images{type: "text/cycle"}
- image_count = 6
[
- (1..image_count).each_with_index do |i|
- path = image_path("image#{i}.jpg")
- comma = "," unless i == image_count
:plain
"<img src='#{path}' alt: ''>"#{comma}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment