Skip to main content

Forums

This topic contains 3 replies, has 2 voices, and was last updated by  Shikkediel 8 months, 1 week ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #277523

    valec
    Participant

    hello:

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

    thanks!

    #277577

    Shikkediel
    Participant

    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…

    #277578

    Shikkediel
    Participant

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

    $(window).scroll(function() {
    
      $('#header').css({
        transform: 'translateX(' + $(this).scrollLeft() + 'px)'
      });
    });
    
    #277580

    Shikkediel
    Participant

    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-link icon-logo-star icon-search icon-star