Skip to main content

How to shrink navbar on scroll ?

Shrink navbar on scroll 



<style>
.nav_logo_scroll{

width: 120px !important;
    transition: all 0.5s linear;
margin-left: 45px
}
.jassi{

width: 100% !important;
  transition: all 0.5s linear;
}
</style>


<script>
jQuery(document).ready(function($){


$(window).scroll(function() {
if($(document).scrollTop() >=1) {
$('.nav').css('position','fixed');
$('.nav_logo').addClass('nav_logo_scroll');
$('.nav_logo').css(' transition','all 0.5s linear');
$('.nav_logo').removeClass('jassi');
}
else if($(document).scrollTop() < 250) {

$('.nav').css('position','relative');
$('.nav').css(' transition','all 0.5s linear');
$('.nav_logo').removeClass('nav_logo_scroll');
$('.nav_logo').addClass('jassi');
}
}
});

});


</script>

Comments

Popular posts from this blog

How to check date format in PHP?

Check date format in PHP function isCorrectDateFromat($date){     if(!empty($date)){         $dateString = $date; // Replace this with your date string         $format = "Y-m-d"; // Replace this with your expected date format         $dateTime = DateTime::createFromFormat($format, $dateString);         if ($dateTime === false) { /*             echo "The date is not in the correct format."; */         } else {             $errors = DateTime::getLastErrors();             if (empty($errors)) { /*                 echo "The date is in the correct format."; */                 return true;             } else { /*                 echo "...