![]() I'm personally making use of this trick on my fullPage.js library because it does a few changes on the DOM on resize. This counter of 500 milliseconds gets restarted with every change in the window dimensions (as we clear the timeout) so the function will only be called if the user stops resizing the window OR if the user resizes the window VERY slowly, which is very unlikely :) That’s way more efficient than needing to bind to a window resize handler Plain JavaScript instead jQuery is rather out of favor these days. With this new release it is possible specify 'grayscale' argument only skipping 'width'. NOTE: This tool uses sharp for image manipulation. If you reach a too low quality factor (ex. Except rather than deal with all that resizing business, FitVids.js loops over all the videos and adds the aspect-ratio enabling HTML wrapper and CSS necessary. Powerful yet simple image manipulation tool. ![]() ResizeId = setTimeout (doneResizing, 500 ) īasically what we do in this case is adding a timeout of 500 milliseconds to call our function doneResizing. Check if the result size in bytes: if the size is greater than 10MB, repeat the compression with a lower quality factor. ![]() ![]() For those cases we don't usually want to execute them tens of times while the user is still re-sizing the window to reach the desired size.įor these particular cases we can use a very simple trick: var resizeId Sometimes we need to execute functions which might take a while to execute or which might consume quite a few resources from the machine. JQuery resize event (or Javascript one) is fired when the size of the browser's window (viewport) changes as pointed out in jQuery documentation. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |