|
<script> |
|
jQuery(document).ready(function () { |
|
|
|
var urls = ["motor-lightrider", "bike-brightcycle", "industry-orbitsun", "sport-utility-brimbeam", "street-streetseen"]; |
|
|
|
var productAr = { |
|
'motor': [ |
|
{'productName': "lightrider", "label": "BUY NOW"} |
|
], |
|
'bike': [ |
|
{'productName': "brightcycle", "label": "BUY NOW"} |
|
], |
|
'industry': [ |
|
{'productName': "orbitsun", "label": "BUY OrbitSun"}, |
|
{'productName': "orbitsunxt", "label": "BUY OrbitSunXT"} |
|
], |
|
'sport-utility': [ |
|
{'productName': "brimbeam", "label": "BUY NOW"} |
|
], |
|
'street': [ |
|
{'productName': "streetseen", "label": "BUY NOW"} |
|
], |
|
}; |
|
|
|
console.log(productAr); |
|
|
|
jQuery.each(productAr, function (key, products) { |
|
if (window.location.href.indexOf(key) > -1 && !(window.location.href.indexOf('product') > -1)) { |
|
|
|
//console.log(products[0]); |
|
|
|
if(key == 'industry') { |
|
var href_0 = "/lumenflex/product/" + products[0].productName + "/" |
|
var label_0 = products[0].label; |
|
|
|
var href_1 = "/lumenflex/product/" + products[1].productName + "/" |
|
var label_1 = products[1].label; |
|
|
|
var buttonHtml = "" + |
|
"<li id=\"menu-item-1004\" class=\"shop-main-menu menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-1003 fusion-megamenu-menu fusion-menu-item-button fusion-last-menu-item\">" + |
|
"<a href=\"" + href_0 + "\" aria-haspopup=\"true\" class=\"orb1\">" + |
|
"<span class=\"menu-text fusion-button button-default button-medium\">" + |
|
"" + label_0 + "" + |
|
"</span>" + |
|
"</a>" + |
|
"<a href=\"" + href_1 + "\" aria-haspopup=\"true\" class=\"orb2\">" + |
|
"<span class=\"menu-text fusion-button button-default button-medium\">" + |
|
"" + label_1 + "" + |
|
"</span>" + |
|
"</a>" + |
|
"</li>"; |
|
} else { |
|
var href = "/lumenflex/product/" + products[0].productName + "/" |
|
var label = products[0].label; |
|
|
|
var buttonHtml = "" + |
|
"<li id=\"menu-item-1004\" class=\"shop-main-menu menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-1003 fusion-megamenu-menu fusion-menu-item-button fusion-last-menu-item\">" + |
|
"<a href=\"" + href + "\" aria-haspopup=\"true\" style=\"line-height: 83px; height: 83px;\">" + |
|
"<span class=\"menu-text fusion-button button-default button-medium\">" + |
|
"" + label + "" + |
|
"</span>" + |
|
"</a>" + |
|
"</li>"; |
|
} |
|
|
|
jQuery("ul#menu-main-menu li").removeClass("fusion-last-menu-item"); |
|
jQuery("ul#menu-main-menu").append(buttonHtml); |
|
|
|
} |
|
}); |
|
|
|
|
|
}); |
|
</script> |