Official Option Set Code -- Custom

// General Scripts //========================== $("#option-set-summary dl>.dl-os-selected").prepend("Default Option"); //text only buttons -- resize to use wider col var $textBtns = $("#option_set_138029 > .option-set-inner, #option_set_138033_wrap, #option_set_138050_wrap, #option_set_138046_wrap, #option_set_138179_wrap"); $textBtns.children(".option-swatch").removeClass("col-md-2").addClass("col-md-3"); // make color swatches 1 column $("#option_set_138038_wrap > div").removeClass("col-md-2 col-xs-6").addClass("col-md-1 col-xs-4"); //var selOptLabel = $(".dl-os-selected").attr('data-label'); //var selOptAccordion = $(".option_set_select_swatch").attr('data-label'); // On Click of summary option, open corresponding accordion on left side $(".dl-os-selected").click(function(){ var selOptLabel = $(this).attr('data-label'); $(".option_set_select_swatch").removeClass('open'); console.log(selOptLabel); $(".option_set_select_swatch[data-label='" + selOptLabel + "']").find("h4").click(); }); //reset all button $("#option-set-summary > h4").append(" Reset All Options"); var $resetAll = $(".product_form").find("button.option-reset"); $(".resetAllBtn").click(function(){ $resetAll.trigger("click"); location.reload(); }); $(".option-reset").click(function(){ $(this).parent().parent().removeClass("option-selected"); }); if ( $(window).width() < 767 ) { $('.option-description-button').on('click', function() { $('.optionDescr').html($(this).parent().find('.optiondesc').html()); $('#optionDescriptionModal').modal('show'); }); } if ( $(window).width() > 767 ) { // Product Bar to the right side of prod $("#productImageBar").insertAfter(".wsm-prod-rating"); $(".product-media").insertAfter("#productImageBar"); $(".option_set_select").closest(".option-description-button").appendTo(".option_label_text"); $('.option-description-button').on('click', function() { $('.optionDescr').html($(this).parent().parent().find('.optiondesc').html()); $('#optionDescriptionModal').modal('show'); }); } $(".wsm-tab-content-header,.option_set_select h4").click(function() { $(this).parent().toggleClass("open") }); $(".option-swatch.active").append("
option selected
"); if ($(".option-set-inner").children('div').length > 1) { $(".option-swatch").change(function() { if($(".option-swatch").hasClass("active")){ $(this).parent().parent().addClass("option-selected"); } }); } $("#wsm-prod-options-box").find(".option_set_select_swatch:first").find("h4").click(); $("#wsm-prod-tab-decrip .wsm-tab-content-header").click(); $("#wsm-prod-options-box .option_set_select_swatch.option_set_select:first-of-type").click(); $(".wsm-prod-options-box").prepend("
Build Your Engine | Select Your Options Below:
"); $('.add__wrapper').append('
Need Help? Call Us Today704.782.7170
'); $(".specs-icon-list").insertAfter(".add__wrapper"); /** Image Modal - attaches image to modal **/ $(function() { $('.enlarge-link').on('click', function() { $('.imagepreview').attr('src', $(this).parent().find('img').attr('src')); $('#imagemodal').modal('show'); }); $('.option-description-button').on('click', function() { //$(this).parent().find('.optiondesc').appendTo('.optionDescr'); $('.optionDescr').html($(this).parent().find('.optiondesc').html()); $('#optionDescriptionModal').modal('show'); }); //$('[data-toggle="tooltip"]').tooltip(); }); function optSelectedNext(){ $('.option-swatch.active .option-swatch-name,.option-swatch.active .option-swatch-price').on('click', function() { $(this).parent().parent().parent().parent().removeClass("open").next().addClass("open"); if($(".option-swatch").hasClass("active")){ $(this).parent().parent().parent().parent().addClass("option-selected"); } }); $('.option-swatch.active .option-swatch-img').on('click', function() { $(this).parent().parent().parent().parent().parent().removeClass("open").next().addClass("open"); if($(".option-swatch").hasClass("active")){ $(this).parent().parent().parent().parent().parent().addClass("option-selected"); } }); } /**Option Selected**/ $(".dl-os-selected").change(function () { $(".dl-os-selected").prepend("Default Option"); }); /** Option Swatch - when selected move to the next option **/ $('.option_set_select_swatch .option-swatch').change(function () { if ($(this).parent().children('div').length > 1) { if($(".option-swatch").hasClass("active")){ $(this).parent().parent().removeClass("open").next().addClass("open") } } optSelectedNext(); }); $('.option-next-step').on('click', function() { $(this).parent().removeClass("open").next().addClass("open"); if($(".option-swatch").hasClass("active")){ $(this).parent().addClass("option-selected"); } }); optSelectedNext(); /** Expand Descriptions **/ // Show more text option var showChar = 29; // How many characters are shown by default var ellipsestext = "..."; var moretext = "Expand"; var lesstext = "Collapse"; //Cut content based on showChar length if ($(".option-swatch-desc").length) { $(".option-swatch-desc").each(function() { var content = $(this).html(); console.log(content); if(content.length > showChar) { var contentExcert = content.substr(0, showChar); var contentRest = content.substr(showChar, content.length - showChar); var html = contentExcert + '' + ellipsestext + ' ' + contentRest + ' ' + moretext + ''; $(this).html(html); } }); } //Toggle content when click on read more link $(".toggle-text-link").click(function(){ if($(this).hasClass("less")) { $(this).removeClass("less"); $(this).html(' ' + moretext); } else { $(this).addClass("less"); $(this).html(' ' + lesstext); } $(this).parent().prev().toggle(); $(this).prev().toggle(); return false; });