Skip to content

Instantly share code, notes, and snippets.

@battis
Created August 3, 2016 15:08
Show Gist options
  • Save battis/5ce73d00bbcbb0a62a6155899c8402ce to your computer and use it in GitHub Desktop.
Save battis/5ce73d00bbcbb0a62a6155899c8402ce to your computer and use it in GitHub Desktop.
Overlay Canvas course card with an arbitrary image
/* assume the course ID we're interested in is 3494 */
var id = 3494;
/* layer in CSS to load an arbitrary image */
$('.ic-DashboardCard__header_hero[data-reactid*="$' + id + '"]').css('background-image', 'url("https://skunkworks.stmarksschool.org/skunkworks.png")')
/*
* interesting next steps to consider include...
*
* - Scanning course file directories for a specifically named card image,
* caching that information and generating the JS dynamically.
* - Adjusting transparency of image in CSS to allow for colored overlay.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment