Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wvuwebgist/fbf48fed5c43c8726501bf9273c78730 to your computer and use it in GitHub Desktop.
Save wvuwebgist/fbf48fed5c43c8726501bf9273c78730 to your computer and use it in GitHub Desktop.
CleanSlate: Randomize the hero image and generate variables for different sizes based on a label:
<r:comment><!-- Randomize the hero image and generate variables for different sizes based on a label: --></r:comment>
<r:files:each labels="random-image-collection" limit="1" types="image" random="true">
<r:set_var name="image_small"><r:file:image_url size="500x400" /></r:set_var>
<r:set_var name="image_large"><r:file:image_url size="1000x800" /></r:set_var>
</r:files:each>
<style>
.wvu-hero {
background-image: url(<r:var name="image_small" />);
} /* /.wvu-hero */
@media (min-width: 501px) {
.wvu-hero {
background-image: url(<r:var name="image_large" />);
} /* /.wvu-hero */
} /* /mq */
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment