This file contains hidden or 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
var initScrollSpy = function() { | |
var navContainer = '#mainNav'; // your navigation container | |
// initial bind of scrollspy | |
var bindScrollSpy = function() { | |
$('body').scrollspy({ | |
target: navContainer, | |
offset: getOffset() // determine your offset | |
}); | |
} |
This file contains hidden or 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
int bufferSize = 64; // buffer size you want to use | |
while(file.available()) // file you previously pointed at | |
{ | |
char buffer[bufferSize]; | |
memset(buffer, '\n', bufferSize); // don't forget to fill the buffer with \n to prevent errors on last buffer read | |
file.read(&buffer, bufferSize); // read from file | |
client->write(buffer, bufferSize); // write to client | |
} |
This file contains hidden or 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
// to make this code working for your Google Maps <iframe> please change the src-attribute to data-src and add the class g-maps | |
// e.g. <iframe class="g-maps" data-src="{your-google-maps-url}" width="100%" height="400" frameborder="0" style="border:0" allowfullscreen></iframe> | |
// you probably also want to prevent container resizing, please use this CSS with your height value: .g-maps { min-height: 400px; } | |
var loadGMapAsync = function() { | |
// determine if container is in viewport | |
// you might pass an offset in pixel - a negative offset will trigger loading earlier, a postive value later | |
// credits @ https://stackoverflow.com/a/33979503/2379196 | |
var isInViewport = function($container, offset) { | |
var containerTop = $container.offset().top; |
This file contains hidden or 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
// you probably also want to prevent container resizing | |
// please use this CSS which works fine with the default v2 reCAPTCHA: .g-recaptcha { height: 78px; min-height: 78px; } | |
var loadRecaptchaAsync = function() { | |
// determine if container is in viewport | |
// you might pass an offset in pixel - a negative offset will trigger loading earlier, a postive value later | |
// credits @ https://stackoverflow.com/a/33979503/2379196 | |
var isInViewport = function($container, offset) { | |
var containerTop = $container.offset().top; | |
var containerBottom = containerTop + $container.outerHeight(); |
This file contains hidden or 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
// starting with 2020 = Copyright (c) YOUR BUSINESS, 2020. All rights reserved. | |
// with 2021 and later = Copyright (c) YOUR BUSINESS, 2020-20xx. All rights reserved. | |
// if you want to start at a different year, simply replace every occurence of 2020 with your desired year | |
<div class="container">Copyright © YOUR BUSINESS, <?php echo '2020' . (date('Y') != 2020 ? '-' . date('Y') : '' ); ?>. All rights reserved.</div> |
This file contains hidden or 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
.opening-hours-section { | |
&.cta { | |
padding: 3rem 0 2.5rem 0; | |
background-color: fade-out($primary, 0.1); | |
.cta-inner { | |
position: relative; | |
padding: 2rem; | |
margin: 0.5rem; | |
background-color: fade-out($white, 0.15); | |
&:before { |
This file contains hidden or 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
<div class="lazy-load-ctn"> | |
<div class="spinner-grow loading-img" role="status"> | |
<span class="sr-only">Loading...</span> | |
</div> | |
<img data-src="img/yourimage.png" class="img-fluid lazy"> | |
</div> |
This file contains hidden or 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
// If you want to explicitly trigger an animation for certain WOW.js elements again. No need to call `init()` and also not wanted (all elements are reset): | |
var triggerAnimation = function(selector, animation) { | |
var $element = $(selector); // get element | |
var element = $element[0]; // get JS element | |
var newone = element.cloneNode(true); // clone it | |
element.parentNode.replaceChild(newone, element); // and replace the old with clone | |
$element = $(selector); // get cloned jQ element | |
$element.addClass('wow ' + animation + ' animated'); // apply animations | |
$element.attr('style', 'visibility: visible; animation-name: ' + animation + ';'); // and styles |
This file contains hidden or 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
// This snippet dynamically resets animation after passing the viewport (scrolling, resizing), hence they are reanimated when viewing them again | |
// Helper function for adding elements to box list in WOW, credits @ https://github.com/matthieua/WOW/issues/46#issuecomment-133760823 | |
WOW.prototype.addBox = function(element) { | |
this.boxes.push(element); | |
}; | |
wow = new WOW(); | |
wow.init(); | |
var checkWOWJsReset = function() { | |
var resetWOWJsAnimation = function() { |
This file contains hidden or 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
// If you want to explicitly trigger an animation for certain WOW.js elements again. No need to call `init()` and also not wanted (all elements are reset): | |
var triggerAnimation = function(selector, animation) { | |
var $element = $(selector); // get element | |
// re-apply animation (style and class) | |
var applyAnimation = function(){ | |
$element = $(selector); | |
$element.addClass('wow ' + animation + ' animated'); | |
$element.attr('style', 'visibility: visible; animation-name: ' + animation + ';'); | |
}; |
OlderNewer