Skip to content

Commit

Permalink
fix for responsive javascript error in slow loading pages (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Jan 22, 2019
1 parent 2af3db6 commit 332c6a2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/javascripts/pagy.js
Expand Up @@ -55,6 +55,7 @@ Pagy.responsive = function(id, tags, widths, series){
lastWidth = undefined,
resizeId = 0,
render = function(){
if (container.clientWidth === 0){ clearTimeout(resizeId); return setTimeout(render, 300) }
var width = widths.find(function(w) {return container.clientWidth > w});
if (width !== lastWidth) {
while (pagyEl.firstChild) { pagyEl.removeChild(pagyEl.firstChild) }
Expand Down

0 comments on commit 332c6a2

Please sign in to comment.