Tagged: x
-
AuthorPosts
-
October 30, 2016 at 4:30 pm #1236965
chrislavcParticipantHi,
I would like to have a different navbar logo when I scroll down. Also, when I come back to top, i would like to see the first logo.
Can you help me with that.
Thanks !
October 30, 2016 at 4:34 pm #1236968
chrislavcParticipantThis reply has been marked as private.October 30, 2016 at 9:48 pm #1237280
Rue NelModeratorHello There,
Thanks for writing in! We could not check your site because the given credential is incomplete. You forgot to give the username. By the way, to achieve what you have in mind, please add the following JS code in the customizer, Appearance > Customize > Custom > Javascript
(function($){ $(window).on('load scroll', function(){ if ( $('.x-navbar').hasClass('x-navbar-fixed-top') ) { $('.x-brand img').attr('src', 'http://placehold.it/120x120'); } else { $('.x-brand img').attr('src', '//theme.co/media/five21.png'); } }); })(jQuery);Feel free to insert the original and replace src of the logo.
Hope this helps.
October 31, 2016 at 10:08 am #1237962
chrislavcParticipantThanks. Everything works fine but how can I resize those 2 images ?
October 31, 2016 at 10:09 am #1237966
chrislavcParticipantThis reply has been marked as private.October 31, 2016 at 10:10 am #1237969
chrislavcParticipantAlso, when I come back at the top, I would like to see the first logo. How can I do this ?
October 31, 2016 at 10:52 am #1238035
Nabeel AModeratorHi again,
Please replace the previous code with this:
(function($){ $(window).on('load scroll', function(){ var headerHeight = $('.x-navbar-inner').height(); if ($(this).scrollTop() > headerHeight) { $('.x-brand img').attr('src', 'http://placehold.it/120x120'); } else { $('.x-brand img').attr('src', '//theme.co/media/five21.png'); } }); })(jQuery);To resize the logo you can add the following code in your Customizer via Appearance > Customize > Custom > Edit Global CSS:
.x-navbar .x-brand img { width: 200px !important; }Don’t forget to clear your browser’s cache after adding the code. Let us know how this goes!
October 31, 2016 at 3:22 pm #1238360
chrislavcParticipantWell it seems like it doesn’t work well… There is a lag when scrolling you can see it on the page “accueil”. Also, I want the logo when scrolling to be 200px high…
Thanks for the help !
November 1, 2016 at 1:47 am #1238780
ChristopherModeratorHi there,
If we force the height with CSS, logo will be stretch. you can try and add height property to following selector :
.x-navbar .x-brand img { height: 200px !important; }Hope it helps.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1236965 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
