Created
          May 31, 2012 00:16 
        
      - 
      
- 
        Save tjdett/2839766 to your computer and use it in GitHub Desktop. 
    Bottom-right pusher
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // Works, but has odd side-effects with complex content | |
| var handlePullBottomRight = function() { | |
| _.chain($(".pull-bottom.pull-right")) | |
| .map(function(v) { return $(v).parent(); }) | |
| .uniq() | |
| .each(function(v) { | |
| var pusher = $('<div></div>').addClass('pusher pull-right') | |
| .css('width','0px'); | |
| var items = $(v).find(".pull-bottom.pull-right"); | |
| var itemsHeight = _.chain(items) | |
| .map(function(v) { return $(v).outerHeight(true); }) | |
| .tap(function(v) { console.debug(v); }) | |
| .reduce(function(a,b) { return a + b; }, 0).value(); | |
| $(v).css('position', 'relative'); | |
| $(v).children(':first-child').before(pusher, items.detach() | |
| .css('clear', 'right')); | |
| var pusherHeightFunc = function() { | |
| console.log("Recalculating height: "+pusher.parent().innerHeight()+" - "+itemsHeight); | |
| return pusher.parent().innerHeight() - itemsHeight; | |
| }; | |
| $(window).on('resize', pusherHeightFunc); | |
| pusher.height(pusherHeightFunc); | |
| }); | |
| }; | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment