Advertisement
orksnork

Untitled

Jul 15th, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 1.42 KB | None | 0 0
  1. var question = questions[Math.floor(Math.random()*questions.length)];
  2. var current = question.number;
  3. var collapsed = 0;
  4. var variable = ""
  5. $(document).ready(function() {
  6.        
  7.     writeQueryVariable();
  8.     writeCount();
  9.  
  10.    
  11.     $('body').on('click', '#flip-1', function(){
  12.         $('#question').fadeOut('400');
  13.         $('#answer-1').fadeIn('400', function() {
  14.             writeQuestion();
  15.         });
  16.     });
  17.     $('body').on('click', '#flip-2', function(){
  18.         $('#question').fadeOut('400');
  19.         $('#answer-2').fadeIn('400', function() {
  20.             writeQuestion();
  21.         });
  22.     });
  23.     $('body').on('click', '.flop', function(){
  24.         $('.answer').fadeOut('400');
  25.         $('#question').fadeIn('400', function(){
  26.             writeAnswer();
  27.             $.ajax({ url: 'script.php' });
  28.             writeCount();
  29.         });
  30.     });
  31.     $('body').on('click', '.btn-submit', function(){
  32.         $('.panel-content').fadeOut('400');
  33.         $('.panel-thanks').fadeIn('400');
  34.     });
  35.     $('#closelink').click(function(){
  36.         if (collapsed == 0) {
  37.             $('#close').fadeTo('slow', 1.0);
  38.             collapsed = 1;
  39.             }
  40.         else {
  41.             $('#close').fadeTo('slow', 0.0);
  42.             collapsed = 0;
  43.         }
  44.        
  45.     });
  46.            
  47.     if (variable == "") {
  48.         mainLoad();
  49.         htmlVariable("nothing");
  50.         }
  51.     else if (variable != ""){
  52.         numberofquestions = questions.length;
  53.         if (variable <= numberofquestions) {
  54.             question = questions[variable]
  55.             mainLoad();
  56.             htmlVariable("in bounds");
  57.             randomQuestion();
  58.             }
  59.         else {
  60.             mainLoad();
  61.             htmlVariable("outta bounds");
  62.         }
  63.     }
  64.    
  65. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement