Thursday, April 18, 2024
HomejQueryToggle Visibility Or CSS Courses Of Components - jQuery qToggle

Toggle Visibility Or CSS Courses Of Components – jQuery qToggle


qToggle is a flexible jQuery content material toggle plugin that lets you toggle the visibility of components utilizing fade or slide animations and handle CSS lessons on these components for styling functions.

It may be used for a mess of use instances, resembling creating dynamic dropdown menus, revealing hidden content material on demand, or managing the looks of components primarily based on consumer preferences.

The way to use it:

1. Obtain and cargo the jquery.qtoggle.js plugin.

<!-- jQuery is required -->
<script src="/path/to/cdn/jquery.min.js"></script>

<!-- jQuery qToggle Plugin -->
<script src="/path/jquery.qtoggle.js"></script>

2. Connect the plugin to all components which have the information attribute ‘data-qtoggle-selector’.

$(perform(){
  $('physique').qToggle();
});

3. Create toggleable components as follows.

<!-- Primary Utilization -->
<a href="#" 
   data-qtoggle-selector=".goal" 
   data-qtoggle-text="Present Data" >
   Conceal Data
 </a>
<div class="goal">
  I'm the div which you could cover and present.
</div>

<!-- Toggle The Prev Factor -->
<a href="#" 
   data-qtoggle-selector="prev" >
   Toggle
</a>

<!-- Toggle The Subsequent Factor -->
<a href="#" 
   data-qtoggle-selector="subsequent" >
   Toggle
</a>

<!-- Toggle The Mum or dad Factor -->
<a href="#" 
   data-qtoggle-selector="mother or father" >
   Toggle
</a>

<!-- Toggle The Siblings -->
<a href="#" 
   data-qtoggle-selector="siblings" >
   Toggle
</a>

<!-- Toggle The Factor Itself -->
<a href="#" 
   data-qtoggle-selector="self" >
   Toggle
</a>

4. Apply fade or slide animations to the weather when toggled.

<a href="#" 
   data-qtoggle-selector=".goal" 
   data-qtoggle-effect="fadeOut">
   Fade Out
</a>

<a href="#" 
   data-qtoggle-selector=".goal" 
   data-qtoggle-effect="present">
   Do not toggle
</a>

<a href="#" 
   data-qtoggle-selector=".goal" 
   data-qtoggle-effect="fadeToggle">
   Fade Toggle
</a>

<a href="#" 
   data-qtoggle-selector=".goal" 
   data-qtoggle-effect="slideToggle">
   Slide Toggle
</a>

<a href="#" 
   data-qtoggle-selector=".goal" 
   data-qtoggle-effect="slideToggle"
   data-qtoggle-easing="swing">
   With Easing
</a>

<a href="#" 
   data-qtoggle-selector=".goal" 
   data-qtoggle-effect="slideToggle"
   data-qtoggle-duration="900">
   Configurable Period
</a>

<a href="#" 
   data-qtoggle-selector=".goal" 
   data-qtoggle-effect="slideToggle"
   data-qtoggle-callback="exampleCallback">
   With A Callback
</a>

5. Toggle the CSS class(es) of the targer ingredient.

<a href="#" 
   data-qtoggle-selector=".goal" 
   data-qtoggle-class="vital" 
   data-qtoggle-effect="toggleClass">
   Toggle CSS Class
</a>
<div class="goal vital">
  This textual content is crimson when class 'vital' is utilized.
</div>

6. All attainable plugin choices.

$('physique').qToggle({

  // object - handed into occasion (reserved for later use)
  'knowledge': {},

  // string - the animation impact on the right track        
  'impact': 'toggle',

  // string - the occasion on management (namespaced)    
  'occasions': 'click on.qToggle',

  // string - a selector that defines a management
  'context': '[data-qtoggle-selector]',

  // string - the title of the information that holds selector string of goal
  'selector': 'qtoggle-selector',

  // string - the default goal if none is laid out in settings.selector  
  'targets': 'prev',

  // string - html to insert into management's textual content node. Empty string for no change                    
  'innerHTML': '',                         

  // string - a category title to toggle if utilizing the toggleClass impact
  'toggleClass': '',   

  // object - arguments handed to the impact perform
  'eventArgs': perform - the perform to name when animation is full
    'callback': null 

  
  
});

This superior jQuery plugin is developed by natebot. For extra Superior Usages, please test the demo web page or go to the official web site.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments