Change Logo Image When Scrolling - Question | JoomShaper
Black Friday sale is live with flat 50% OFF. Sale ends soon! Grab your deal now!

Change Logo Image When Scrolling

K

Krzysztof Procajło

Helix Framework 4 years ago

Hello, I have a to different version of logo - bigger (with icon) and smaller (with only text). How i can change it when user scroll site down and sp-header go to sticky/fixed version? I know how i can change it width (through CSS), but dont know change img.

Regards!

0
4 Answers
Ofi Khan
Ofi Khan
Accepted Answer
Support Agent 4 years ago #18448

Hello Krzysztof Procajło

Please use this CSS to Template Options -> Custom Code -> Custom CSS

#sp-header.header-sticky .logo img { 
    opacity: 0; 
}
#sp-header.header-sticky .logo a { 
    background-image: url(images/Joomla-flat-logo-en.png);  /* use your image link to show when scrolling */
    background-repeat: no-repeat; 
    background-size: contain; 
}

Best regards

0
K
Krzysztof Procajło
Accepted Answer
4 years ago #18458

Great! It works fine with slightly changed code at class - #sp-header.menu-fixed:

#sp-header.menu-fixed .logo img { 
    opacity: 0; 
}
#sp-header.menu-fixed .logo a { 
    background-image: url(images/logo2.png);  /* use your image link to show when scrolling */
    background-repeat: no-repeat; 
    background-size: contain; 
}

Thank You!

0
Ofi Khan
Ofi Khan
Accepted Answer
Support Agent 4 years ago #18468

You are welcome

0
Ofi Khan
Ofi Khan
Accepted Answer
Support Agent 4 years ago #18469

I have a humble request. It would be very kind of you if you can manage some moment to give us feedback here:

  1. JED
  2. Trustpilot
0