JulianLargo Posted May 15 Share Posted May 15 Hi, I'm experiencing a minor issue with a website I have built. I have added a second button to my header for customers to enquire. It works fine on every page except when on a blog post. This is the code I have used, can't remember who I copied the code from but at the bottom, their name is there: <script> $( ( ) => { /* begin header buttons add License : < https://bit.ly/3F8sn8W > Version : 0.8.0 SS Version : 7.1 Fluid Engine Compatible : Not Applicable Dependencies : jQuery By : Thomas Creedon < http://www.tomsWeb.consulting/ > */ const buttonsAdd = [ /* following is an example of a new button data structure. copy the example new button data structure and paste after the example new button data structure. remove the forward slash asterisk and asterisk forward slash lines from before and after the copied example. repeat for as many new buttons you want to create. this has been done once initially */ /* { text : '[ENQUIRE NOW]', url : '[enter url here between single quotes replacing square brackets]', // type is is optional. values are secondary, or tertiary type : '[optional, enter type here between single quotes replacing square brackets]' }, */ { text : 'ENQUIRE NOW', url : 'generic-enquiry', // type is is optional. values are secondary or tertiary type : '[optional, enter type here between single quotes replacing square brackets]' }, ] /* targetAtttributeValue is an optional setting. enter _self, _blank, _parent, _top, or framename see < https://mzl.la/2Q0JROF > between single quotes */ const targetAtttributeValue = ''; /* buttonOriginalTargetAttributeAdd is an optional setting. use false or true. when true the target attribute will be added to SS's built-in cta button */ const buttonOriginalTargetAttributeAdd = false; // do not change anything below, there be the borg here const codeName = 'Header Buttons Add'; const selector = '.header-actions-action--cta, .header-menu-cta'; const typeClassMap = { secondary : 'sqs-button-element--secondary', tertiary : 'sqs-button-element--tertiary' }; const version = '0.8.0'; const s = `${ codeName } v${ version }, ` + 'License < https://tinyurl.com/s872fb68 >, ' + 'Tom\'s Web Consulting < http://www.tomsWeb.consulting >'; console.log ( s ); $( selector ).each ( function ( ) { const $this = $( this ); const $buttonOriginal = $( '.btn:first', $this ); $.each ( buttonsAdd, function ( index, buttonAdd ) { const $button = $buttonOriginal .clone ( ) .attr ( 'href', buttonAdd.url ) .text ( buttonAdd.text ) .appendTo ( $this ); if ( targetAtttributeValue ) $button.attr ( 'target', targetAtttributeValue ); const clss = typeClassMap [ buttonAdd.type ]; if ( clss == undefined ) return true; // continue $button .removeClass ( 'sqs-button-element--primary' ) .addClass ( clss ); } ); if ( buttonOriginalTargetAttributeAdd && targetAtttributeValue ) $buttonOriginal.attr ( 'target', targetAtttributeValue ); } ); /* end header buttons add */ } ); </script> Link to comment
JulianLargo Posted May 15 Author Share Posted May 15 This is the website on a random page for you guys to see: Blog Link to comment
Solution tuanphan Posted May 16 Solution Share Posted May 16 Try changing this to this text : 'ENQUIRE NOW', url : '/generic-enquiry', Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment