Skip to content

Instantly share code, notes, and snippets.

@hacknug
Created March 29, 2018 16:44
Show Gist options
  • Save hacknug/196f5818480d7d231f1dde5f700eef0d to your computer and use it in GitHub Desktop.
Save hacknug/196f5818480d7d231f1dde5f700eef0d to your computer and use it in GitHub Desktop.
Design Does (feat. Albert Rivera from Ciutadans)
#home-layout .grid .block.manifesto-block .brick-wrapper {
padding: 0;
}
#home-layout .grid .block.manifesto-block .jsgif,
#home-layout .grid .block.manifesto-block .jsgif canvas {
width: 100%;
height: 100%;
}
#home-layout .grid .block.manifesto-block .jsgif canvas {
object-fit: cover;
}
function create_manifesto_gif() {
jQuery(".manifesto-block .brick-wrapper").each(function() {
jQuery(this)
.find(".jsgif")
.remove();
var src =
"//2.bp.blogspot.com/-mWNKJGGv43w/WVSo5SDLy2I/AAAAAAACJqs/QkW_laK_EcMHZZk-RmrpKFZOrT6nlsFVgCLcBGAs/s1600/e77a5c1f75c28abe70b166145647ea69.gif";
var newImg = new Image();
newImg.src = src;
jQuery(this).append(newImg);
jQuery(newImg).on("load", function() {
var maxWidth = jQuery(this).width(),
parent = jQuery(this).parent(),
el = new SuperGif({
gif: this,
progressbar_height: 0,
max_width: maxWidth,
auto_play: 0
});
el.load(function() {
console.log("Manifesto gif hacked");
el.move_to(10);
parent.parents(".block").on("mouseenter", function() {
el.play();
});
parent.parents(".block").on("mouseleave", function() {
el.pause();
});
});
});
});
}
create_manifesto_gif();
setTimeout(function() {
create_manifesto_gif();
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment