Skip to content
Vova Yatsyuk edited this page Mar 25, 2014 · 26 revisions

How to questions.

Activate and scroll to tab on external link click

There are two possible ways to implement this feature:

  1. Edit the link href and class attributes in template source:
<a href="#TAB_ALIAS_FROM_BACKEND" class="easytabs-anchor">Description</a>

For Example, the link below will activate the description tab:

<a href="#product_tabs_description_tabbed" class="easytabs-anchor">Descirption</a>
  1. Use the external javascript to add the onclick observers.
   $$('WRITE_SELECTOR_HERE').first()
       .observe('click', function(e) {
           e.stop();

           var element = e.element(),
               tab     = 'review',
               scroll  = true;
           easytabs.onclick(element , e, tab, scroll);
       });

For example, the code below shows how to add onclick event to the Write Review and Read Reviews links:

   $$('.rating-links a, .no-rating a').each(function(el) {
       el.observe('click', function(e) {
           e.stop();

           easytabs.onclick(el, e, 'review', true);
           if (el.href.indexOf('#review-form') > -1) {
               $('review-form') && $('review-form').scrollTo();
           }
       });
   });
Clone this wiki locally