<?xml version="1.0" encoding="UTF-8"?>
	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

			>

	<channel>

		<title>Open Accordion element with Button (.x-btn) &#8211; Themeco Community</title>
		<atom:link href="https://theme.co/archive/forums/topic/open-accordion-element-with-button-x-btn/feed/" rel="self" type="application/rss+xml" />
		<link>https://theme.co/archive/forums/topic/open-accordion-element-with-button-x-btn/feed/</link>
		<description></description>
		<lastBuildDate>Wed, 15 Oct 2025 09:02:10 +0000</lastBuildDate>
		<generator>https://bbpress.org/?v=2.6.14</generator>
		<language>en-US</language>

		
														
					
				<item>
					<guid>https://theme.co/archive/forums/topic/open-accordion-element-with-button-x-btn/#post-121508</guid>
					<title><![CDATA[Open Accordion element with Button (.x-btn)]]></title>
					<link>https://theme.co/archive/forums/topic/open-accordion-element-with-button-x-btn/#post-121508</link>
					<pubDate>Wed, 08 Oct 2014 18:11:26 +0000</pubDate>
					<dc:creator>sladestyle</dc:creator>

					<description>
						<![CDATA[
						<p>Hi,<br />
I know this has been discussed and I have read over what I think is all of the threads related to this topic but I cannot seem to figure out how to make it work.</p>
<p>I have added this code into my custom js</p>
<pre><code>jQuery(function($){

	$(document).ready(function(){ jump_to_tab( $, $(&#039;.x-nav-tabs .x-nav-tabs-item a[href=&quot;#&#039; + location.href.split(&quot;#&quot;).slice(-1)[0] + &#039;&quot;], .x-accordion-toggle a[href=&quot;#&#039; + location.href.split(&quot;#&quot;).slice(-1)[0] + &#039;&quot;]&#039;) ); });
	$(&#039;.enable_jump_to&#039;).click( function(e){ e.preventDefault(); jump_to_tab($, $(&#039;.x-nav-tabs .x-nav-tabs-item a[href=&quot;&#039; + $(this).attr(&#039;data-jump-target&#039;) + &#039;&quot;], .x-accordion-toggle a[href=&quot;&#039; + $(this).attr(&#039;data-jump-target&#039;) + &#039;&quot;]&#039;) ); } );

});

function jump_to_tab($, tab_nav) {
			if(tab_nav.length &gt;=1) {
	            $(tab_nav).click();
	            $(&#039;html,body&#039;).animate({scrollTop: $(tab_nav).offset().top - ( $(&#039;.x-navbar&#039;).height() + 50 )},700 ,&#039;swing&#039;);
        	}
}</code></pre>
<p>The Accordion has an ID called &#8220;makeup&#8221; (without quotes). It is in the button area that I am unclear what to put and where.  I am using Visual Composer. Does everything go into the &#8216;href&#8217; input box? By everything I mean — #makeup  class=&#8221;enable_jump_to&#8221; data-jump-target=&#8221;#collapse-2&#8243; ??</p>
<p>I attempted this with a straight link which seems like it would be simpler but never could get it to work either.</p>
<p>The URL is <a href="http://www.geoffreydonnephotography.com/pricing-packages/" rel="nofollow">http://www.geoffreydonnephotography.com/pricing-packages/</a><br />
The Accordion element is the second one you see on the left called &#8220;Do I really need professional&#8230;.&#8221; and the trigger button is on the right almost to the bottom called &#8220;Makeup &amp; Hair&#8221;.</p>
<p>Thanks!<br />
Slade</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/open-accordion-element-with-button-x-btn/#post-121976</guid>
					<title><![CDATA[Reply To: Open Accordion element with Button (.x-btn)]]></title>
					<link>https://theme.co/archive/forums/topic/open-accordion-element-with-button-x-btn/#post-121976</link>
					<pubDate>Thu, 09 Oct 2014 08:43:10 +0000</pubDate>
					<dc:creator>Rubin</dc:creator>

					<description>
						<![CDATA[
						<p>Hey There,</p>
<p>Add the JavaScript to your Customizer > Custom > JavaScript section:</p>
<pre><code>jQuery(function($){

	$(document).ready(function(){ jump_to_tab( $, $(&#039;.x-nav-tabs .x-nav-tabs-item a[href=&quot;#&#039; + location.href.split(&quot;#&quot;).slice(-1)[0] + &#039;&quot;], .x-accordion-toggle a[href=&quot;#&#039; + location.href.split(&quot;#&quot;).slice(-1)[0] + &#039;&quot;]&#039;) ); });
	$(&#039;.enable_jump_to&#039;).click( function(e){ e.preventDefault(); jump_to_tab($, $(&#039;.x-nav-tabs .x-nav-tabs-item a[href=&quot;&#039; + $(this).attr(&#039;data-jump-target&#039;) + &#039;&quot;], .x-accordion-toggle a[href=&quot;&#039; + $(this).attr(&#039;data-jump-target&#039;) + &#039;&quot;]&#039;) ); } );

});

function jump_to_tab($, tab_nav) {
			if(tab_nav.length &gt;=1) {
	            $(tab_nav).click();
	            $(&#039;html,body&#039;).animate({scrollTop: $(tab_nav).offset().top - ( $(&#039;.x-navbar&#039;).height() + 50 )},700 ,&#039;swing&#039;);
        	}
}</code></pre>
<p>Then you simply add the link/button anywhere on the page you want looking like this:</p>
<pre><code>&lt;a href=&quot;#&quot; class=&quot;enable_jump_to&quot; data-jump-target=&quot;#collapse-1&quot;&gt;Jump and Open Accordion #1&lt;/a&gt;</code></pre>
<p>if you edit your button your button code would look like this:</p>
<pre><code>&lt;a class=&quot;x-btn x-btn-rounded x-btn-small enable_jump_to&quot; data-jump-target=&quot;#collapse-1&quot; href=&quot;#&quot; data-toggle=&quot;none&quot; data-placement=&quot;top&quot; data-trigger=&quot;hover&quot; data-options=&quot;thumbnail: &#039;&#039;&quot;&gt;Makeup &amp; Hair&lt;/a&gt;</code></pre>
<p>Thats it! Let me know if it worked.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/open-accordion-element-with-button-x-btn/#post-122003</guid>
					<title><![CDATA[Reply To: Open Accordion element with Button (.x-btn)]]></title>
					<link>https://theme.co/archive/forums/topic/open-accordion-element-with-button-x-btn/#post-122003</link>
					<pubDate>Thu, 09 Oct 2014 09:22:30 +0000</pubDate>
					<dc:creator>sladestyle</dc:creator>

					<description>
						<![CDATA[
						<p>Hi, thanks for the response.</p>
<p>I&#8217;m still unclear as to &#8220;where&#8221; I place the button code. Your first example looks like a simple text link and the second&#8230;looks like a text link as well but only sort-of 🙂 I am using an .x-btn (button).</p>
<p>When I click the pencil icon for my button&#8230;Where exactly do I place &#8220;what&#8221;? My options appear to be the href, ID, Class, and Style input boxes only. I tried to place all of that into the href but that didn&#8217;t work.</p>
<p>My last attempt was to use the Text editor and place the button using the X short codes. It was even more unclear where this code would go.</p>
<p>Sorry&#8230;</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/open-accordion-element-with-button-x-btn/#post-122367</guid>
					<title><![CDATA[Reply To: Open Accordion element with Button (.x-btn)]]></title>
					<link>https://theme.co/archive/forums/topic/open-accordion-element-with-button-x-btn/#post-122367</link>
					<pubDate>Thu, 09 Oct 2014 16:15:00 +0000</pubDate>
					<dc:creator>Zeshan</dc:creator>

					<description>
						<![CDATA[
						<p>Hi there,</p>
<p>Thank you for writing in!</p>
<p>We&#8217;re sorry for the confusion. In such case, you cannot use button shortcode. You will need to use button HTML code as mentioned above in the Classic Mode. </p>
<p>However, with some custom development, you can add an attribute of <strong>data_jump_target=&#8221;&#8221;</strong> to your [button] shortcode. To do so, I&#8217;d advise that you setup a <a href="http://theme.co/x/member/kb/how-to-setup-child-themes/" title="Child Themes" target="_blank" rel="nofollow">child theme</a>. This allows you to make code changes that won&#8217;t be overwritten when an <strong>X</strong> update is released. After your child theme is setup, please review how we recommend making template changes in <a href="http://theme.co/x/member/kb/customization-best-practices/" rel="nofollow">Customization Best Practices</a>.</p>
<p>After that, add the following code in your child theme&#8217;s <strong>functions.php</strong> file:</p>
<pre><code>// Buttons
// =============================================================================

function x_shortcode_button2( $atts, $content = null ) {
  extract( shortcode_atts( array(
    &#039;id&#039;               =&gt; &#039;&#039;,
    &#039;class&#039;            =&gt; &#039;&#039;,
    &#039;style&#039;            =&gt; &#039;&#039;,
    &#039;type&#039;             =&gt; &#039;&#039;,
    &#039;shape&#039;            =&gt; &#039;&#039;,
    &#039;size&#039;             =&gt; &#039;&#039;,
    &#039;float&#039;            =&gt; &#039;&#039;,
    &#039;block&#039;            =&gt; &#039;&#039;,
    &#039;circle&#039;           =&gt; &#039;&#039;,
    &#039;icon_only&#039;        =&gt; &#039;&#039;,
    &#039;href&#039;             =&gt; &#039;&#039;,
    &#039;title&#039;            =&gt; &#039;&#039;,
    &#039;target&#039;           =&gt; &#039;&#039;,
    &#039;info&#039;             =&gt; &#039;&#039;,
    &#039;info_place&#039;       =&gt; &#039;&#039;,
    &#039;info_trigger&#039;     =&gt; &#039;&#039;,
    &#039;info_content&#039;     =&gt; &#039;&#039;,
    &#039;lightbox_thumb&#039;   =&gt; &#039;&#039;,
    &#039;lightbox_video&#039;   =&gt; &#039;&#039;,
    &#039;lightbox_caption&#039; =&gt; &#039;&#039;,
    &#039;data_jump_target&#039; =&gt; &#039;&#039;
  ), $atts ) );

  $id    = ( $id    != &#039;&#039; ) ? &#039;id=&quot;&#039; . esc_attr( $id ) . &#039;&quot;&#039; : &#039;&#039;;
  $class = ( $class != &#039;&#039; ) ? &#039; &#039; . esc_attr( $class ) : &#039;&#039;;
  $style = ( $style != &#039;&#039; ) ? &#039;style=&quot;&#039; . $style . &#039;&quot;&#039; : &#039;&#039;;
  $type  = ( $type  != &#039;&#039; ) ? &#039; x-btn-&#039; . $type : &#039;&#039;;
  $shape = ( $shape != &#039;&#039; ) ? &#039; x-btn-&#039; . $shape : &#039;&#039;;
  $size  = ( $size  != &#039;&#039; ) ? &#039; x-btn-&#039; . $size : &#039;&#039;;
  switch ( $float ) {
    case &#039;left&#039; :
      $float = &#039; alignleft&#039;;
      break;
    case &#039;right&#039; :
      $float = &#039; alignright&#039;;
      break;
    default :
      $float = &#039;&#039;;
  }
  $block            = ( $block            == &#039;true&#039;  ) ? &#039; x-btn-block&#039; : &#039;&#039;;
  $icon_only        = ( $icon_only        == &#039;true&#039;  ) ? &#039; x-btn-icon-only&#039; : &#039;&#039;;
  $href             = ( $href             != &#039;&#039;      ) ? $href : &#039;#&#039;;
  $title            = ( $title            != &#039;&#039;      ) ? &#039;title=&quot;&#039; . $title . &#039;&quot;&#039; : &#039;&#039;;
  $target           = ( $target           == &#039;blank&#039; ) ? &#039;target=&quot;_blank&quot;&#039; : &#039;&#039;;
  $info             = ( $info             != &#039;&#039;      ) ? &#039;data-toggle=&quot;&#039; . $info . &#039;&quot;&#039; : &#039;&#039;;
  $info_place       = ( $info_place       != &#039;&#039;      ) ? &#039;data-placement=&quot;&#039; . $info_place . &#039;&quot;&#039; : &#039;&#039;;
  $info_trigger     = ( $info_trigger     != &#039;&#039;      ) ? &#039;data-trigger=&quot;&#039; . $info_trigger . &#039;&quot;&#039; : &#039;&#039;;
  $info_content     = ( $info_content     != &#039;&#039;      ) ? &#039;data-content=&quot;&#039; . $info_content . &#039;&quot;&#039; : &#039;&#039;;
  $lightbox_thumb   = ( $lightbox_thumb   != &#039;&#039;      ) ? $lightbox_thumb : &#039;&#039;;
  $lightbox_video   = ( $lightbox_video   == &#039;true&#039;  ) ? &#039;, width: 1080, height: 608&#039; : &#039;&#039;;
  $lightbox_caption = ( $lightbox_caption != &#039;&#039;      ) ? &#039;data-caption=&quot;&#039; . $lightbox_caption . &#039;&quot;&#039; : &#039;&#039;;
  $data_jump_target = ( $data_jump_target != &#039;&#039;      ) ? &#039;data-jump-target=&quot;&#039; . $data_jump_target . &#039;&quot;&#039; : &#039;&#039;;

  if ( is_numeric( $lightbox_thumb ) ) {
    $lightbox_thumb_info = wp_get_attachment_image_src( $lightbox_thumb, &#039;full&#039; );
    $lightbox_thumb      = $lightbox_thumb_info[0];
  }

  if ( $lightbox_video != &#039;&#039; ) {
    $lightbox_options = &quot;data-options=\&quot;thumbnail: &#039;&quot; . $lightbox_thumb . &quot;&#039;{$lightbox_video}\&quot;&quot;;
  } else {
    $lightbox_options = &quot;data-options=\&quot;thumbnail: &#039;&quot; . $lightbox_thumb . &quot;&#039;\&quot;&quot;;
  }

  if ( $circle == &#039;true&#039; ) {
    $output = &quot;&lt;div {$id} class=\&quot;x-btn-circle-wrap{$size}{$block}{$float}\&quot; {$style}&gt;&lt;a class=\&quot;x-btn{$class}{$type}{$shape}{$size}{$block}{$icon_only}\&quot; href=\&quot;{$href}\&quot; {$data_jump_target} {$title} {$target} {$info} {$info_place} {$info_trigger} {$info_content} {$lightbox_caption} {$lightbox_options}&gt;&quot; . do_shortcode( $content ) . &quot;&lt;/a&gt;&lt;/div&gt;&quot;;
  } else {
    $output = &quot;&lt;a {$id} class=\&quot;x-btn{$class}{$type}{$shape}{$size}{$block}{$float}{$icon_only}\&quot; {$style} href=\&quot;{$href}\&quot; {$data_jump_target} {$title} {$target} {$info} {$info_place} {$info_trigger} {$info_content} {$lightbox_caption} {$lightbox_options}&gt;&quot; . do_shortcode( $content ) . &quot;&lt;/a&gt;&quot;;
  }
  
  return $output;
}

add_filter(&#039;init&#039;, function() {
   remove_shortcode( &#039;button&#039; );

   add_shortcode( &#039;button&#039;, &#039;x_shortcode_button2&#039; );
});
</code></pre>
<p>After that, add a attribute of <strong>data_jump_target=&#8221;#collapse-1&#8243;</strong> in the [button] shortcode. For example:</p>
<p><code>[button href="#" data_jump_target="#collapse-1"] Jump and Open Accordion #1 [/button]</code></p>
<p>Hope this helps. 🙂</p>
<p>Thank you.</p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

