Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search

fuzzypyro

Member
  • Posts

    2
  • Joined

  • Last visited

  1. I attached a few screenshots showing what it does now as well as what my goal is. Here is the forum I pulled the code from. hopefully it can offer some insight. Thank you! https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwiT0eqCstjsAhUNs54KHV5kBeEQFjAAegQIBRAC&url=https%3A%2F%2Fforum.squarespace.com%2Ftopic%2F49530-how-do-i-create-hideshow-section-of-an-entire-page-of-text-images-and-or-galleries-in-squarespace-spoiler-functionaccordiancollapse%2F&usg=AOvVaw1hjyjHHzyxbr5KlfWMdbhY
  2. I am trying to create an acceptance button using the code provided below. I can not figure out how to hide the text above when the text below is shown. I know there are much easier ways to make an acceptance button but this is just how I wanna do mine. Any help on the topic would be greatly appreciated. I honestly don't even know what language this is to be exact. It looks like javascript to me but my friend tells me its not. <script> /* This script is a custom script to control the 'show' / 'hide' extra feature. To use: give each button you want to make an expander an href of "expand-3", if you want it to expand / collapse the next 3 blocks. Make sure to make each button say 'Show More' as its default text. */ var SHOW_MORE = 'I Accept' var COLLAPSE = 'Show Agreement' $(window).load(function(){ // prepares all buttons by wrapping the correct # of following divs into a div with class 'extra_gallery' $('a[href^="#expand"]').each(function(){ // parse # of sibling elements to wrap from href attribute and then wrap them. var n = parseInt($(this).attr('href').split('-')[1]); var next_n_divs = $(this).parents('div.sqs-block').nextAll().slice(0,n) // this is the line that is different. we use display:none; on the DOM element that wraps the additional gallery. next_n_divs.wrapAll('<div class="extra-gallery" style="display:none;"></div>'); /* // preload_images next_n_divs.find('img').each(function(){ image = new Image(); image.src = $(this).attr('data-src')+'?format=500w'; console.log($(this).attr('data-src')); }); // control for click behavior */ $(this).click(function(){ var target_gallery = $(this).parents('div.sqs-block').next('div.extra-gallery') if (target_gallery.is(':visible')){ $(this).text(SHOW_MORE); } else { $(this).text(COLLAPSE); } target_gallery.slideToggle(); return false; }); }); }); </script>
×
×
  • Create New...