simulate position:fixed with bottom (jquery)


/ Published in: JavaScript
Save to your folder(s)

wild scope on genuineBottom...


Copy this code and paste it in your HTML
  1. var genuineBottom = parseInt($("#alertwindow-'.$view->getParam("uniqid").'").css("bottom").slice(0,-2),10);
  2. if (genuineBottom == undefined || genuineBottom == NaN)
  3. {
  4. genuineBottom = 0;
  5. }
  6.  
  7. $(window).scroll(function() {
  8. offset = $($("#alertwindow-'.$view->getParam("uniqid").'")).offset();
  9. var newTop = $(window).height() - $("#alertwindow-'.$view->getParam("uniqid").'").height() + $(window).scrollTop() - genuineBottom;
  10. $("#alertwindow-'.$view->getParam("uniqid").'").css("top", newTop + "px");
  11. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.