Ranga14

LouisRichardWatches.com Lazy Loader+QTip JQuery Integration

Aug 14th, 2013
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var bSuppressScroll = false;
  2.         $(document).ready(function()
  3.         {
  4.            
  5.             function last_msg_funtion()
  6.             {
  7.                 var ID=$(".message_box:last").attr("id");
  8.                 $('div#last_msg_loader').html('<img src="./images/bigLoader.gif">');
  9.                 $.post("index.php?action=get&last_msg_id="+ID,
  10.            
  11.                 function(data) {
  12.                     if (data != "") {
  13.                         $(".message_box:last").after(data);
  14.                         window.bSuppressScroll = false;
  15.                     }
  16.                     $('div#last_msg_loader').empty();
  17.                     $('div#last_msg_loader').hide();
  18.                 });
  19.             };         
  20.             $(window).scroll(function(){
  21.                 if ( ( $(window).scrollTop() == $(document).height() - $(window).height() ) && window.bSuppressScroll == false ){
  22.                     last_msg_funtion();
  23.                     window.bSuppressScroll = true;
  24.                 }
  25.             });
  26.                        
  27.             // Load Modal
  28.             $(document).on('mouseenter', "#grid li a", function() {
  29.                 $("#grid li a").each(function (){
  30.                     //var id = $(this).data('rel');
  31.                     $(this).click(function(){
  32.                         return false;
  33.                     });
  34.                         $(this).qtip({
  35.                             content: {
  36.                                 prerender: true,
  37.                                 text: 'Loading...',
  38.                                 ajax: {
  39.                                     //url: 'watch.php?pID=' + $(this).attr("href"),
  40.                                     url: $(this).attr("href"),
  41.                                     //url: './watch.php',
  42.                                     type: 'GET', // POST or GET
  43.                                     //data: '?pID=' + id,
  44.                                     success: function(data, status) {
  45.                                         this.set('content.text', data);
  46.                                         // Init tabs
  47.                                         $("#thumbs ul", this.elements.content).idTabs();
  48.                                     }
  49.                                 }
  50.                             },
  51.                             position: {
  52.                                 my: 'center',
  53.                                 at: 'center',
  54.                                 target: $(window),
  55.                                 corner: 'topMiddle',
  56.                                 adjust: {
  57.                                     scroll: false
  58.                                     //method: 'shift none'
  59.                                 }
  60.                             },
  61.                             style: {
  62.                                 width: '620px',
  63.                                 height: '500px',
  64.                                 classes: 'qtip-rounded qtip-shadow'
  65.                             }, //style
  66.                             show: {
  67.                                 //ready: true,
  68.                                 event: 'click',
  69.                                 delay:0,
  70.                                 solo:true,                 
  71.                                 modal:{on:true}
  72.                             },
  73.                             hide: {
  74.                                 event: 'click'
  75.                             },
  76.                             onHide: function() { $(this).qtip('destroy'); }
  77.                         });
  78.                     //}
  79.                     // End qtip check
  80.                 });
  81.             });
  82.             function getParameterByName(name) {
  83.                 var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
  84.                 return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
  85.             }
  86.         });
Add Comment
Please, Sign In to add comment