-
AuthorPosts
-
February 19, 2018 at 3:58 pm #914330
Hello,
I build a page with a fixed menu and logo that overlaps the bottom of the navigation line. For the beginning of every page and blog entry it’s like it should be.
If any user scrolls down, I want to exchange this logo with another image file and straighten the bottom of the navigation line.
Similar example, how it should work: http://gleichpersonaltraining.com/
What can I do, to reach this?
February 19, 2018 at 4:55 pm #914389Hey brandhands,
Try adding this php code at the bottom of functions.php:
function add_custom_script(){ ?> <script> var $document = $(document), $element = $('#header'), className = 'hasScrolled'; $document.scroll(function() { if ($document.scrollTop() >= 5) { $element.addClass(className); } else { $element.removeClass(className); } }); </script> <?php } add_action('wp_footer', 'add_custom_script');
then add this css code in Quick CSS (located in Enfold > General Styling):
#top #header.hasScrolled .logo, #top #header.hasScrolled .logo a { height: 80px !important; } #top #header.hasScrolled .logo img { content: url('image'); max-height: 80px; }
Just replace image with the logo you posted in private content. Hope this helps :)
Best regards,
NikkoFebruary 20, 2018 at 10:51 am #914776Hello,
thank you for the code. The effect is working, but finally the image doesn’t work.
I have also tried ” instead of ‘ and to upload the image with a height of 80 px:
My whole code in style.css (child folder) now is:
div .logo { left: 0px; z-index: 10000; top: 0px; height: 150px; background-color: #ff7300; } #top #header.hasScrolled .logo, #top #header.hasScrolled .logo a { height: 80px !important; } #top #header.hasScrolled .logo img { content: url('http://herbon.de/soldier/wp-content/uploads/2018/02/ofpt_apfel_transp_80.png'); max-height: 80px; }
- This reply was modified 6 years, 10 months ago by brandhands.
February 20, 2018 at 1:07 pm #914813Hi,
I have checked your site and it seems to be working fine. Can you tell us how we can see the problem? what do you mean by the image doesn’t work? we’ll try to help you with it once we can reproduce it on our end.
Best regards,
NikkoFebruary 21, 2018 at 10:04 am #915331This is the top. That’s good.
http://herbon.de/soldier/wp-content/uploads/2018/02/OFPT_top.jpgThis is after scrolling now:
http://herbon.de/soldier/wp-content/uploads/2018/02/OFPT_scrolled_now.jpgThis is how it should be after scrolling:
http://herbon.de/soldier/wp-content/uploads/2018/02/OFPT_scrolled_should_be.jpgThe image for the logo after scrolling should be this:
http://herbon.de/soldier/wp-content/uploads/2018/02/ofpt_apfel_transp_80.pngFebruary 21, 2018 at 12:06 pm #915370Hi,
I see, it’s all good in chrome but it doesn’t work on firefox, I added this css code in your Quick CSS (located in Enfold > General Styling):
#top #header.hasScrolled .logo a { background-image: url(https://herbon.de/soldier/wp-content/uploads/2018/02/ofpt_apfel_transp_80.png); max-height: 80px; } #top #header.hasScrolled .logo img { visibility: hidden; opacity: 0; filter: alpha(opacity=0); }
Let us know if this works on your end. :)
Best regards,
NikkoFebruary 21, 2018 at 12:35 pm #915393Thank you. Now it works at firefox as well.
February 21, 2018 at 12:41 pm #915398Hi,
Glad that we could help. :) Let us know if you need further assistance or if we can close this thread.
Best regards,
NikkoFebruary 23, 2018 at 2:19 pm #916694Hello,
another question:
what should I have to do, to stretch an element from container area outside to the full screen? (as the same as the background image in any fullwidth color section)
especially I want to stretch the map in the bottom of the startpage and I want to have no space between the map and the footer.
February 23, 2018 at 8:51 pm #916862Hi,
You can do that from the settings of the section, the element can go full width.
Best regards,
BasilisFebruary 24, 2018 at 12:22 am #916931Hi. I’m trying to also get my logo to change upon scrolling but I didn’t have any luck with the code.
February 26, 2018 at 3:04 am #917627Hi jimmiesner,
Can you try to create a separate thread? and give us temporary admin access, just post the details in private content so the details can only be seen by the moderators and the thread creator. Also please add a link to this thread on that new thread so we can use as a reference :)
Best regards,
NikkoFebruary 26, 2018 at 7:54 pm #917947Thanks!
You’ll find that info in this thread: https://kriesi.at/support/topic/want-logo-to-change-when-scrolling/
Jim
-
AuthorPosts
- You must be logged in to reply to this topic.