Last active
April 12, 2023 18:20
-
-
Save allilevine/d97664b2ce981894f755 to your computer and use it in GitHub Desktop.
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
// I wanted to use this method (http://codepen.io/jcasabona/pen/fKgCA) of displaying random background images with Sass, but I didn't want to type out each image file name, so instead I used a loop: | |
$random_images_path: "../../../uploads/"; | |
$imagesarray: (''); | |
@for $i from 1 through 40 { | |
$value: $random_images_path + "/sitename" + $i + ".jpg"; | |
$imagesarray: append($imagesarray, $value); | |
} | |
$img: nth($imagesarray, random(length($imagesarray) -1)); | |
#content { | |
background: url($img) no-repeat center center; | |
background-size: cover; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment