Skip to content

Commit

Permalink
Fix: If any span or a dont exists width is NaN
Browse files Browse the repository at this point in the history
  • Loading branch information
mervit committed Apr 5, 2017
1 parent 035b9c9 commit 345afae
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions responsive-paginate.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,12 @@
var width = 0;
for (var i = 0; i < $container.find("li").length; i++)
{
width += $container.find("li").eq(i).children("a").eq(0).outerWidth();
width += $container.find("li").eq(i).children("span").eq(0).outerWidth();
if($container.find("li").eq(i).children("a").eq(0).length > 0){
width += $container.find("li").eq(i).children("a").eq(0).outerWidth();
}
if($container.find("li").eq(i).children("span").eq(0).length > 0){
width += $container.find("li").eq(i).children("span").eq(0).outerWidth();
}
}
return width;
}
Expand Down

0 comments on commit 345afae

Please sign in to comment.