Skip to content

Instantly share code, notes, and snippets.

@pavlo-bondarchuk
Created April 25, 2020 18:58
Show Gist options
  • Select an option

  • Save pavlo-bondarchuk/255c3f4c08645ea6a54d94eb841b2eca to your computer and use it in GitHub Desktop.

Select an option

Save pavlo-bondarchuk/255c3f4c08645ea6a54d94eb841b2eca to your computer and use it in GitHub Desktop.
at-spectr
jQuery(document).ready(function($){
var el = $('.realfactory-header-wrap');
var top = $(el).offset().top + $(document).scrollTop();
var el_height = $(el).height();
$(document).scroll(function(){
var scrollTop = $(document).scrollTop();
var $logo = $( '<div class="logo"></div>');
console.log(scrollTop);
if ( scrollTop > el_height && !el.is('.highlighted') ){
$(el).addClass('highlighted');
$('.realfactory-container ').prepend($logo);
console.log('highlighted add');
}
if ( scrollTop < el_height && el.is('.highlighted')){
$(el).removeClass('highlighted');
$('.logo').remove();
console.log('highlighted remove');
}
});
});q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment