Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- //Code to fill the size boxes on the product page. THIS IS BEING USED!
- jQuery('#picker_choose-size li label').click(function() {
- console.log('Clicked!');
- // Out with the old...
- jQuery('#picker_choose-size li').removeClass("highlighted");
- // ...and in with the new
- jQuery(this).closest('li').addClass('highlighted');
- console.log('Finished');
- });
- jQuery('.select-option.swatch-wrapper').tooltip({
- items: "[data-tooltip]",
- content: function () {
- return jQuery('.tooltip1').attr("data-tooltip");
- }
- });
- jQuery('.page-id-174 #picker_addon > div:nth-child(2)').on('click',function(){
- jQuery('.gallery-2').hide();
- jQuery('.gallery-21').hide();
- jQuery('.gallery-3').hide();
- jQuery('.gallery-31').hide();
- jQuery('.gallery-1').show('slow');
- jQuery('.gallery-11').show();
- gallerySrc = '//agilitybed.com/wp-content/uploads/2017/03/1-mattress.jpg'
- swapPic.attr('src',gallerySrc);
- swapPic.attr('srcset',gallerySrc);
- });
- jQuery('.page-id-174 #picker_addon > div:nth-child(3)').on('click',function(){
- jQuery('.gallery-2').show('slow');
- jQuery('.gallery-21').show();
- jQuery('.gallery-3').hide();
- jQuery('.gallery-31').hide();
- jQuery('.gallery-1').hide();
- jQuery('.gallery-11').hide();
- gallerySrc = '//agilitybed.com/wp-content/uploads/2017/03/2-foundation.jpg'
- swapPic.attr('src',gallerySrc);
- swapPic.attr('srcset',gallerySrc);
- });
- jQuery('.page-id-174 #picker_addon > div:nth-child(4)').on('click',function(){
- jQuery('.gallery-2').hide();
- jQuery('.gallery-21').hide();
- jQuery('.gallery-3').show('slow');
- jQuery('.gallery-31').show();
- jQuery('.gallery-1').hide();
- jQuery('.gallery-11').hide();
- gallerySrc = '//agilitybed.com/wp-content/uploads/2017/03/1-mattress0428-1.jpg'
- swapPic.attr('src',gallerySrc);
- swapPic.attr('srcset',gallerySrc);
- });
- jQuery(function($){
- descriptionButton = $('body .mat-desc-acc .q_accordion_holder.accordion h5.ui-accordion-header:nth-child(1)');
- deliveryButton = $('body .mat-desc-acc .q_accordion_holder.accordion h5.ui-accordion-header:nth-child(3)');
- certificationButton = $('body .mat-desc-acc .q_accordion_holder.accordion h5.ui-accordion-header:nth-child(5)');
- descriptionText = $('.mat-desc-acc .ui-accordion-header:nth-child(1) .tab-title');
- deliveryText = $('.mat-desc-acc .ui-accordion-header:nth-child(3) .tab-title');
- certificationText = $('.mat-desc-acc .ui-accordion-header:nth-child(5) .tab-title');
- descriptionButton.on('click',function(){
- console.log('before if');
- if(descriptionText.text() === "- DESCRIPTION")
- {
- console.log('close');
- descriptionText.html('+ DESCRIPTION');
- console.log('after');
- }
- else{
- console.log('open');
- descriptionText.html('- DESCRIPTION');
- }
- deliveryText.html('+ DELIVERY & SETUP');
- certificationText.html('+ CERTIFICATIONS');
- console.log('Plus Switch Outside 1');
- });
- deliveryButton.on('click',function(){
- console.log('before if');
- if(deliveryText.text() === "- DELIVERY & SETUP")
- {
- console.log('close');
- deliveryText.html('+ DELIVERY & SETUP');
- console.log('after');
- }
- else{
- console.log('open');
- deliveryText.html('- DELIVERY & SETUP');
- }
- descriptionText.html('+ DESCRIPTION');
- certificationText.html('+ CERTIFICATIONS');
- console.log('Plus Switch Outside 1');
- });
- certificationButton.on('click',function(){
- console.log('before if 3');
- if(certificationText.text() === "- CERTIFICATIONS")
- {
- console.log('close 3');
- certificationText.html('+ CERTIFICATIONS');
- console.log('after 3');
- }
- else{
- console.log('open 3');
- certificationText.html('- CERTIFICATIONS');
- }
- descriptionText.html('+ DESCRIPTION');
- deliveryText.html('+ DELIVERY & SETUP');
- console.log('Plus Switch Outside 3');
- });
- jQuery('.page-id-174 #picker_addon > div:nth-child(2)').on('click',function(){
- jQuery('.mat-only-switch').show();
- jQuery('.foundation-only-switch').hide();
- jQuery('.adjustable-only-switch').hide();
- jQuery('#product-102 .size-shop_single').attr('src','//agilitybed.com/wp-content/uploads/2017/03/1-mattress-600x446.jpg');
- });
- jQuery('.page-id-174 #picker_addon > div:nth-child(3)').on('click',function(){
- jQuery('.mat-only-switch').hide();
- jQuery('.foundation-only-switch').show();
- jQuery('.adjustable-only-switch').hide();
- jQuery('#product-102 .size-shop_single').attr('src','//agilitybed.com/wp-content/uploads/2017/03/2-foundation.jpg');
- });
- jQuery('.page-id-174 #picker_addon > div:nth-child(4)').on('click',function(){
- jQuery('.mat-only-switch').hide();
- jQuery('.foundation-only-switch').hide();
- jQuery('.adjustable-only-switch').show();
- jQuery('#product-102 .size-shop_single').attr('src','//agilitybed.com/wp-content/uploads/2017/03/1-mattress0428-1.jpg');
- });
- smallBeds = $('#wc_checkout_add_ons_2_field');
- largeBeds = $('#wc_checkout_add_ons_3_field');
- addonSmall = $('.sfn-cart-addons .post-906');
- addonLarge = $('.sfn-cart-addons .post-913');
- addonField = $('.sfn-cart-addons');
- addonTypeSmall = $('.variation-Addon p:contains("Mattress"), .variation-Addon p:contains("Mattress + Foundation")');
- sizeTypeSmall = $('.variation-ChooseSize p:contains("TWIN"), .variation-ChooseSize p:contains("TWIN XL"), .variation-ChooseSize p:contains("FULL") ' );
- addonTypeLarge = $('.variation-Addon p:contains("Mattress"), .variation-Addon p:contains("Mattress + Foundation")');
- sizeTypeLarge = $('.variation-ChooseSize p:contains("QUEEN"), .variation-ChooseSize p:contains("KING"), .variation-ChooseSize p:contains("CAL KING") ' );
- smallBedCheck = $('[data-product_sku="twin-001"], [data-product_sku="twin-002"], [data-product_sku="twinxl-001"], [data-product_sku="twinxl-002"], [data-product_sku="full-001"], [data-product_sku="full-002"]');
- largeBedCheck = $('[data-product_sku="queen-001"], [data-product_sku="queen-002"], [data-product_sku="king-001"], [data-product_sku="king-002"], [data-product_sku="calking-001"], [data-product_sku="calking-002"]');
- if (smallBedCheck.length > 0) {
- addonSmall.show();
- addonField.show();
- }
- if (largeBedCheck.length > 0) {
- addonLarge.show();
- addonField.show();
- }
- jQuery(".page-id-174 #picker_addon > div:nth-child(3)").addClass('starting-fade');
- jQuery(".page-id-174 #picker_addon > div:nth-child(4)").addClass('starting-fade');
- $("#read-more-btny").click(function(e) {
- e.preventDefault();
- $("#read-less-btny").show();
- $("#read-more-btny").hide();
- $( ".hidden-reviews0519" ).show( "slow" );
- console.log('readmore test');
- });
- $("#read-less-btny").click(function(e) {
- e.preventDefault();
- $("#read-less-btny").hide();
- $("#read-more-btny").show();
- $( ".hidden-reviews0519" ).hide( "slow" );
- console.log('readmore test');
- });
- galleryBtny = $('.mo-gallery-img');
- swapPic = $('img.attachment-shop_single.size-shop_single.wp-post-image');
- zoomPic = $('a.woocommerce-main-image.zoom');
- galleryBtny.on('click',function(e){
- e.preventDefault();
- gallerySrc = $(this).attr('href');
- gallerySrcHero = $(this).attr('rel');
- swapPic.attr('src',gallerySrc);
- swapPic.attr('srcset',gallerySrcHero);
- zoomPic.attr('href',gallerySrc);
- console.log($(this).find('img').attr('src'));
- console.log('she ran');
- });
- jQuery('.videoPopUpLink a').on('click',function() {
- $n.fancybox({
- 'overlayColor':'#000000',
- 'hideOnOverlayClick':false,
- 'padding': 0,
- 'autoScale': true,
- 'autoDimensions': false,
- 'showCloseButton': true,
- 'content':'<iframe src="https://player.vimeo.com/video/217874617?color=334a6d&title=0&byline=0&portrait=0&autoplay=1" width="100%" height="100%" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>',
- 'transitionIn':'fade',
- 'transitionOut':'elastic',
- 'width': window.innerWidth < 768 ? parseInt(window.innerWidth*90/100) : 768,
- 'height': window.innerWidth < 768 ? parseInt(window.innerWidth*90/100)/1.77778 : 432
- });
- });
- jQuery('.videoPopUpLinkFoundation a').on('click',function() {
- $n.fancybox({
- 'overlayColor':'#000000',
- 'hideOnOverlayClick':false,
- 'padding': 0,
- 'autoScale': true,
- 'autoDimensions': false,
- 'showCloseButton': true,
- 'content':'<iframe src="https://player.vimeo.com/video/217874567?color=334a6d&title=0&byline=0&portrait=0&autoplay=1" width="100%" height="100%" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>',
- 'transitionIn':'fade',
- 'transitionOut':'elastic',
- 'width': window.innerWidth < 768 ? parseInt(window.innerWidth*90/100) : 768,
- 'height': window.innerWidth < 768 ? parseInt(window.innerWidth*90/100)/1.77778 : 432
- });
- });
- jQuery('#wptbheadline1 img').on('click',function(){
- $('.header_inner_left').removeClass('top-bar-spacing')
- });
- $('#newsletter_signup2 img').bind('touchstart touchend touchup', function(event) {
- event.stopPropagation();
- });
- });
- jQuery('a.swatch-anchor').on('click',function(){
- jQuery(".page-id-174 #picker_addon > div:nth-child(3)").removeClass('starting-fade');
- jQuery(".page-id-174 #picker_addon > div:nth-child(4)").removeClass('starting-fade');
- if (this.classList.contains('cleary-bg')){
- jQuery("a.swatch-anchor").removeClass('more-fadey-bg');
- jQuery("a.swatch-anchor").removeClass('cleary-bg');
- }else{
- console.log('clicked2');
- jQuery("a.swatch-anchor").addClass('more-fadey-bg');
- jQuery("a.swatch-anchor").removeClass('cleary-bg');
- jQuery(this).removeClass('more-fadey-bg');
- jQuery(this).addClass('cleary-bg');
- console.log('finished2');
- console.log(jQuery(this).attr('title'));
- }
- if (jQuery(this).attr('title').indexOf('Adjustable') > -1 ){
- jQuery('.swatch-control.radio-select li').addClass('more-widthy');
- }
- else{
- jQuery('.swatch-control.radio-select li').removeClass('more-widthy');
- }
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement