mrsdonovan

Hack for Infinite Scroll not working on IE 8

Sep 13th, 2012
423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.91 KB | None | 0 0
  1. jQuery(document).ready(function() {
  2.    
  3.  
  4. /*
  5.  * A IE javascript detection function from:
  6.  * http://james.padolsey.com/javascript/detect-ie-in-js-using-conditional-comments/
  7.  */
  8. var ie = (function(){
  9.  
  10.     var undef,
  11.         v = 3,
  12.         div = document.createElement('div'),
  13.         all = div.getElementsByTagName('i');
  14.  
  15.     while (
  16.         div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
  17.         all[0]
  18.     );
  19.  
  20.     return v > 4 ? v : undef;
  21.  
  22. }());
  23.  
  24. /*
  25.  * Now using the function above, stop the infinitescroll javascript from operating.
  26.  * Notes:
  27.  *  - Change "#main_blog" to the "Content Seletctor" your are using under your Infinite Scroll settings
  28. *   - Use a "try" in case we are not on a page where the infinitescroll javascript is not loaded.
  29.  */
  30.  try
  31.   {
  32.     if (ie < 9 ) {
  33.         $("#main_blog").infinitescroll("pause");
  34.     }
  35.   }
  36. catch(err)
  37.   {
  38.   //Handle errors here
  39.   }
  40.  
  41. });
Add Comment
Please, Sign In to add comment