Advertisement
nefi_c

ajax custom script

Feb 5th, 2013
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 1.42 KB | None | 0 0
  1. jQuery(document).ready(function($){
  2. /* ------ Setup Tab Functionality ------ **/
  3.     // Setup First Tab
  4.     jQuery('#tabs ul li a:first').addClass('active');
  5.     // Click
  6.     jQuery('#tabs ul li a').click(function(event){
  7.          event.preventDefault();
  8.         // Load Content
  9.         var myterm = jQuery(this).attr('href').substring(1);
  10.         jQuery.ajax({
  11.             url: my_wp.ajaxurl,
  12.             data: { action: my_wp.action, term : myterm }, // action data should match hook for example 'my_action' match with 'wp_ajax_my_action' and 'wp_ajax_nopriv_my_action'
  13.             success: function(content){    
  14.                 jQuery('#whitepapersshow').fadeTo(300, 0.05, function($){
  15.                     jQuery(this).html(content);
  16.                     jQuery(this).cycle({
  17.                         fx:     'scrollHorz',
  18.                         easing:  'easeOutQuad',
  19.                         speed:   800,
  20.                         timeout: 8000,
  21.                         pause: 1,
  22.                         next:   '#nextPapers',
  23.                         prev:   '#prevPapers',
  24.                         slideResize: false,
  25.                     }).fadeTo(900, 1.0);
  26.                     jQuery(".tabpopup").fadeOut(0);
  27.                     // Global Process
  28.                     jQuery(".mediumgraybutton").mouseenter(function(){
  29.                         jQuery("#po"+this.id).fadeIn(400);
  30.                     });
  31.                     jQuery(".tabpopup").mouseleave(function(){
  32.                         jQuery(this).fadeOut(600);
  33.                     });
  34.                    
  35.                 });
  36.             }
  37.         });
  38.  
  39.         // Update Nav Status
  40.         jQuery('#tabs ul li a').removeClass('active');
  41.         jQuery(this).addClass('active');
  42.     });
  43. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement