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
// Get Data Attribute | |
// ------------------------------------------------------------------------------------------ | |
var elemData = elem.getAttribute('data-label'); | |
// Remove from DOM | |
// ------------------------------------------------------------------------------------------ | |
elemToDelete.parentNode.removeChild(elemToDelete); |
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
let scrollPos = 0; | |
const Elem = document.querySelector('.element'); | |
function checkPosition() { | |
let windowY = window.scrollY; | |
if (windowY < scrollPos) { | |
// Scrolling UP | |
Elem.classList.add('is-visible'); | |
Elem.classList.remove('is-hidden'); | |
} else { |
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
let scrollpos = window.scrollY | |
const headerElem = document.querySelector(".dress-details") | |
const headerElemHeight = headerElem.offsetHeight | |
const add_class_on_scroll = () => headerElem.classList.add("fixed") | |
const remove_class_on_scroll = () => headerElem.classList.remove("fixed") | |
window.addEventListener('scroll', function() { | |
scrollpos = window.scrollY; | |
if (scrollpos >= headerElemHeight) { add_class_on_scroll() } | |
else { remove_class_on_scroll() } |
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
<?php echo file_get_contents(getcwd() . '/wp-content/themes/basetheme/assets/svg/images-optimized/svg-image.svg'); ?> |
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
<?php | |
$string_raw = '<a href="#">This is an example link</a>'; | |
$string_formatted = preg_replace('/(<a\b[^><]*)>/i', '$1 data-scroll>', $string_raw); | |
?> |
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
// Webkit (Chrome & Safari, any version) | |
@media screen and (-webkit-min-device-pixel-ratio:0) { | |
// style. | |
} | |
// Firefox (any version) | |
@-moz-document url-prefix() { | |
// style. | |
} |
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
// IE8, IE9, IE10 | |
@media screen\0 { | |
// styles | |
} | |
// IE9 Only | |
@media screen and (min-width:0\0) and (min-resolution: .001dpcm) { | |
// styles | |
} |
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
// This approach is based upon the elements width. | |
.element { | |
position: relative; | |
width: 100%; | |
display: block; | |
&:after { | |
display: block; | |
content: ''; |
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
## TOGGLE CLASSES IN JAVASCRIPT AFTER ANIMATION END | |
// Example taken from Animation.css | |
// - https://daneden.github.io/animate.css/ | |
function testAnim(x) { | |
$('#animationSandbox').removeClass().addClass(x + ' animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){ | |
$(this).removeClass(); | |
}); | |
}; |