Created
April 29, 2016 07:28
-
-
Save pzi/aea4fbb664f283abcf077d48b913364e to your computer and use it in GitHub Desktop.
Use cycle2 with progressive loading in Haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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