"repaint" in javascript, is there?

Asked

Viewed 140 times

2

I’m developing a website and added the lionscroll plugin (to show that bar similar to Facebook, which disappears and appears, depending on the position of the cursor). Anyway, here’s the problem...

When I am in desktop resolution, it works (as if it is in mobile version). But, if I change to another resolution, the plugin breaks the layout and makes the content disappear... if I reload the page it works again

Example, tested in browser...

With size 1200px it works, if I change to 480px it gives dick... If I go in at 480px and switch to 1200px it goes...

I wonder if you have how to give a "repaint", when there is the resize event in the window, to see if this would solve the problem.

There is that in js?

  • You can put an example with HTML? jsFiddle for example. Layout differences are done with javascript?

  • Take a look here http://ajaxian.com/archives/forcing-a-ui-redraw-from-javascript and here http://stackoverflow.com/questions/8840580/force-dom-redraw-refresh-on-chrome-mac

  • A repaint should not help, you need to see if your plugin has any method to update the dimensions after resizing the window, or restart the plugin as suggested by Paulo Maciel.

1 answer

1


If the problem occurs only when you change the size of the window, you could disable and activate the plugin again after performing the resize:

$( window ).resize(function() {
    // desativa e ativa plugin
});
  • No use, same thing happens.

  • @Renang Put your code to http://jsfiddle.net and edit your question so we can take a closer look at your problem

  • I put the site on the air, posted earlier: http://www.rxnxn2014.xpg.com.br/ Go to the "missions" tab, minimize and see. Then load it minimized and maximize the window.

  • 1

    @Renang your problem is that the layout is setting a fixed width, so when you change the window size, the layout does not fit. I accessed the site here and through the element inspector of Safari I put width:auto; in the <section id='mission'> and na <div class='kb-wrap'> and it worked.

  • 1

    Perfect! Solved!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.