Search
 
SCRIPT & CODE EXAMPLE
 

CSS

position sticky css

/*
Try add this class to the element that you would like to make "sticky"
 - I hope it helps, happy coding ^_^
*/
.sticky{
  position: -webkit-sticky; /* Safari */
  position: sticky;
  top: 0; 
}
Comment

css position sticky

div{
  position: sticky;
  top:0;
}
Comment

position sticky css

.sticky{
  	position: stickey;
    top: 0;
  	left: 0;
}
Comment

Sticky Div

$(document).ready(function($){
	jQuery('.testimonials-slider-single').each(function(){
		var slider = jQuery(this);
		var arrowsHolder = slider.closest('.testimonials').find('.slider-nav');

		if (!slider.hasClass('slick-initialized')) {
			dots: false,
				slider.slick({
				prevArrow: '<button class="icon-prev slick-prev"></button>',
				nextArrow: '<button class="icon-next slick-next"></button>',
				arrows: true,
				slidesToShow: 1,
				slidesToScroll: 1,
				rows: 0,
				autoplay: true,
				appendArrows: arrowsHolder,
				adaptiveHeight: true
			});
		}
	});
	
	var $sticky = $('.res-article .cta-sec');
	var $stickyrStopper = $('.res-learning');
	if (!!$sticky.offset()) { // make sure ".sticky" element exists

		var generalSidebarHeight = $sticky.innerHeight();
		var stickyTop = $sticky.offset().top;
		var stickOffset = 100;
		var stickyStopperPosition = $stickyrStopper.offset().top;
		var stopPoint = stickyStopperPosition - generalSidebarHeight - stickOffset;
		var diff = stopPoint + stickOffset;

		$(window).scroll(function(){ // scroll event
			var windowTop = $(window).scrollTop(); // returns number

			if (stopPoint < windowTop) {
				$sticky.css({ position: 'absolute', top: diff });
			} else if (stickyTop < windowTop+stickOffset) {
				$sticky.css({ position: 'fixed', top: stickOffset });
			} else {
				$sticky.css({position: 'absolute', top: 'initial'});
			}
		});
	}
	
});
Comment

PREVIOUS NEXT
Code Example
Css :: convert string to uppercase while typing 
Css :: how to center a text input in css 
Css :: transition background gradient 
Css :: remove border radius select css 
Css :: scss hover 
Css :: rainbow text css 
Css :: onclick jquery add css 
Css :: how to add fade-in with page transition 
Css :: margin for text in html 
Css :: CSS background blur or glass effect 
Css :: postcss-preset-env: end value has mixed support, consider using flex-end instead 
Css :: souligner titre css 
Css :: circle button css 
Css :: css selector not contains attribute 
Css :: tint image css 
Css :: sass watch in all your project automatically 
Css :: text decoration underline not removing 
Css :: image rotate css 
Css :: normalize css npm 
Css :: how to add a background color in css 
Css :: how to remove text highlight on double click 
Css :: jquery change css variiable value 
Css :: css image transition fade 
Css :: how to add a background overlay in css 
Css :: overflow x not hidden 
Css :: center pop up css 
Css :: add css to class=["col-"] 
Css :: how to move text down css 
Css :: center div vertically and horizontally 
Css :: input type file without button 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =