问题
I have an iframe with pdf on my page and try to disable scrolling of main window while scrolling iframe. Here is the code for it:
$('iframe')
.mouseover(function () {
var html = $('html');
html.data('previous-overflow', html.css('overflow'));
html.css('overflow', 'hidden');
html.css('margin-right', '17px');
})
.mouseout(function () {
// un-lock scroll position
var html = $('html');
html.css('overflow', html.data('previous-overflow'));
html.css('margin-right', '0px');
});
But such css changes causing flickering of iframe content (using Chrome 13). How can i fix this blinking?
回答1:
If you want to work on all browsers and OS, the only way is to use custom scrollbars such as Tiny scrollbar or you can take a loot at this scrollbars list http://www.net-kit.com/jquery-custom-scrollbar-plugins/.
来源:https://stackoverflow.com/questions/7200425/iframe-with-pdf-black-flickeringblinking