Advertisement
Guest User

Untitled

a guest
Nov 16th, 2013
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. $(document).ready(function(){
  3.  
  4.  
  5.     /* ---- Countdown timer ---- */
  6.  
  7.     $('#counter').countdown({
  8.         timestamp : (new Date()).getTime() + 15*24*60*60*1000
  9.     });
  10.  
  11.  
  12.     /* ---- Animations ---- */
  13.  
  14.     $('#links a').hover(
  15.         function(){ $(this).animate({ left: 3 }, 'fast'); },
  16.         function(){ $(this).animate({ left: 0 }, 'fast'); }
  17.     );
  18.  
  19.     $('footer a').hover(
  20.         function(){ $(this).animate({ top: 3 }, 'fast'); },
  21.         function(){ $(this).animate({ top: 0 }, 'fast'); }
  22.     );
  23.  
  24.  
  25.     /* ---- Using Modernizr to check if the "required" and "placeholder" attributes are supported ---- */
  26.  
  27.     if (!Modernizr.input.placeholder) {
  28.         $('.email').val('Input your e-mail address here...');
  29.         $('.email').focus(function() {
  30.             if($(this).val() == 'Input your e-mail address here...') {
  31.                 $(this).val('');
  32.             }
  33.         });
  34.     }
  35.  
  36.     // for detecting if the browser is Safari
  37.     var browser = navigator.userAgent.toLowerCase();
  38.  
  39.     if(!Modernizr.input.required || (browser.indexOf("safari") != -1 && browser.indexOf("chrome") == -1)) {
  40.         $('form').submit(function() {
  41.             $('.popup').remove();
  42.             if(!$('.email').val() || $('.email').val() == 'Input your e-mail address here...') {
  43.                 $('form').append('<p class="popup">Please fill out this field.</p>');
  44.                 $('.email').focus();
  45.                 return false;
  46.             }
  47.         });
  48.         $('.email').keydown(function() {
  49.             $('.popup').remove();
  50.         });
  51.         $('.email').blur(function() {
  52.             $('.popup').remove();
  53.         });
  54.     }
  55.  
  56.  
  57. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement