Tagged: x
-
AuthorPosts
-
September 29, 2016 at 8:41 am #1195730
alriteamParticipantHello,
I have developed custom sticky header for one of page. Only problem is transition is not smooth.
URL : https://jamminofficial.staging.wpengine.com/jammin-masterclass
Please look at below CSS Code
div#x-section-1{ margin: 0px; padding: 0px; visibility: visible !important; position: fixed !important; z-index: 1; display: inline; width: 100%; transition: all 1s ease; } div#x-section-1.sticky{ height:100px; transition: all 1s ease; } #mc-logo { width:110px; transition: all 1s ease; } #mc-logo.sticky { width:55px; }JS Code
jQuery(function($) { $(window).scroll(function(){ if($(this).scrollTop()<=0) { $('#x-section-1').removeClass('sticky'); $('#mc-logo').removeClass('sticky'); }else{ $('#x-section-1').addClass('sticky'); $('#mc-logo').addClass('sticky'); } }); });Thanks.
September 29, 2016 at 10:26 am #1195868
RupokMemberHi there,
You will need jQuery UI library to set transition on such case as it’s not usually possible to set transition here on toggling classes.
Thanks!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1195730 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
