daily pastebin goal
52%
SHARE
TWEET

script.js

kybernaut Jun 1st, 2017 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function($) {
  2.        
  3. $(document).ready(function() {
  4.  
  5.     //smooth scroll
  6.     var root = $('html, body');
  7.         $("a:not([href*=popup-]").click(function() {
  8.         root.animate({
  9.             scrollTop: $( $.attr(this, 'href') ).offset().top -50
  10.         }, 1000);
  11.         return false;
  12.     });
  13.    
  14.     //popup url replace as class
  15.     $("a[href*='#popup-']").each(function(){
  16.       $( this ).addClass( this.href.split('#').pop() );
  17.    });
  18.  
  19.    //popup after send
  20.   if(window.location.hash) {
  21.       var hash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character
  22.      
  23.       if (hash.indexOf("wpcf7") >= 0) {
  24.  
  25.         console.log('here');
  26.  
  27.         var wpmudev_popup = window._popup_data.popup;
  28.         var i;
  29.         for( i = 0, l = wpmudev_popup.length; i < l; i++ ) {
  30.             var html = wpmudev_popup[i].html;
  31.             console.log(hash);
  32.             //console.log(html);
  33.             if (html.indexOf(hash) >= 0) {
  34.                
  35.                 console.log('--- here ---');
  36.                 var anchor = wpmudev_popup[i].display_data.click;
  37.                 anchor = anchor.replace('.', '#');
  38.                 console.log(anchor);
  39.                 //$('a[href="'+anchor+'"]').trigger( "click" );
  40.                 $('a[href="'+anchor+'"]').click();
  41.             }  
  42.            
  43.         }
  44.  
  45.    }
  46.  }
  47.  
  48. });
  49.    
  50. })( jQuery );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top