Forums

Give help. Get help.

  • # October 11, 2018 at 9:16 am

    hello:

    any idea on how to make a div fixed only by the scroll x not y ?

    thanks!

    # October 12, 2018 at 1:44 am

    The example from your previous topic seems to work fine…

    codepen.io/anon/pen/WaENbX

    Edit – I overlooked the issue with IE when I posted this. And no more IE11 support for JSFiddle or Codepen apparently…

    # October 12, 2018 at 1:57 am

    You could try if this is any smoother (doesn’t require repaints):

    $(window).scroll(function() {
    
      $('#header').css({
        transform: 'translateX(' + $(this).scrollLeft() + 'px)'
      });
    });
    
    # October 12, 2018 at 4:15 am

    Doesn’t look too smooth on Firefox. Here’s another approach (logic is likely up for some revision as is usually the case with these things):

    codepen.io/anon/pen/XxaXzN

    Seems to work well, can’t imagine IE giving any issues.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag