Anchor link within sticky bar

  • 19 June 2019
  • 3 replies
  • 102 views

Hello,

I am using below script for the sticky bar - I have it for the #lp-pom-box-907 (which is the sticky header) - the header is transparent and within the #lp-pom-box-907, I have a button which is visible and should be an anchor to a box that is almost at the bottom of the page. Using the JS and setup from this article: https://documentation.unbounce.com/hc/en-us/articles/360022719471 I was not able to get it working, so does that have to do something with the JS for the sticky bar?

Here is JS I am using for the sticky bar:

//Fixed Menu (Header or footer) v1.3.1

/**
* Do not remove this section; it allows our team to troubleshoot and track feature adoption.
* TS:0002-13-013
*/

//Replace ID below with your own box ID
var boxToAppend = ‘#lp-pom-box-907’;

//Set to ‘header’ or ‘footer’
var headerOrFooter = ‘header’;

var backgroundCSS = {“position”:“fixed”, “left”:“0”, “top”:“0px”, “bottom”:“auto”, “width”:“100%”, “z-index”:“899”};
var colorOverlayCSS = {“position”:“fixed”, “left”:“0”, “top”:“0px”, “bottom”:“auto”, “width”:“100%”, “z-index”:“auto”, “border-style”:“none none none none”};
var childrenCSS = {“position”:“fixed”, “left”:“auto”, “top”:“0px”, “bottom”:“auto”, “width”:“100%”, “z-index”:“999”, “border-style”:“none none none none”, “border-width”:“0px”, “background”:“none”};

if (headerOrFooter === ‘footer’) {
backgroundCSS[“top”] = ‘auto’;
backgroundCSS[“bottom”] = ‘0px’;
colorOverlayCSS[“top”] = ‘auto’;
colorOverlayCSS[“bottom”] = ‘0px’;
childrenCSS[“top”] = ‘auto’;
childrenCSS[“bottom”] = ‘0px’;
}

var boxParent = (boxToAppend).parent(); var boxClone = (boxToAppend).clone()

boxClone.appendTo(boxParent).css(backgroundCSS).children().remove();
(boxToAppend).css(childrenCSS); (boxToAppend + ‘-color-overlay’).appendTo(boxClone).css(colorOverlayCSS);

Thank you!


3 replies

Userlevel 5

Hey @Jan_Urbanek 🙂

Could you share the URL to the page this is on? That would be helpful to see what might be happening on the page.

Hey Kyle,

I was able to solve this problem on my own. Thank you that you were willing to help! 🙂

Jan

Badge

What was your solution? Im having the same issue. Trying to link the buttons inside the sticky bar to jump to various sections on the page. So far, I’ve only testing linking “photos” to the photo section. Any help would SUPER appreciated.

See here - https://online.homeusa.com/portfolio/

Reply