@Riot How to fix your Riot Comments so that it doesn't travel to Uganda.

Sir Frosthaven·10/13/2013, 7:04:30 PM·2 votes·615 views

Here's how to fix your "Rioter Comments" box so that it doesn't drop below the content container. I'm assuming you are using Jquery and fixed positioning to have it snap currently.

First, you need to get the offset for the BOTTOM of the main content container:

  • var bottomBound = $('#page-main').offset().top + $('#page-main').height();

Now, within your scrolling event, you need to update the bottom position of your riot comment's panel

  • var el= $('#rioter-comments-widget');
  • var panelBottom = $(this).scrollTop() + el.height() + parseInt('#pvpnet-bar').height());

Finally, within the scrolling section that moves the panel or sets it to fixed positioning, you need to add an if structure:

  • if (panelBottom >= bottomBound) {
  • var offset = bottomBound - $(this).scrollTop - el.height();
  • el.css('top',offset + 'px');
  • } else {
  •  //set your fixed positioning up here~
    
  • }

If you guys are using a slightly abnormal way of sticking the post tracker to the viewport, you can modify the above code as needed. Now let's see some controlled Rioter Comments panels! :D

I'm using a similar setup in my playground coding atm to stick the page header to the top of the screen while also preventing it from going further than the "Show More" button: Image Here

3 Comments

RiotKrylhos10/16/2013, 12:42:10 AM4 votes

Just rolled out a patch for this. Thanks for keeping this on our radar!

RiotKrylhos10/15/2013, 6:39:10 PM2 votes

But but...Uganda!

I'll get this patched up today :)