Commit 7efa1ddb authored by Boris Schauer's avatar Boris Schauer

[BUGFIX] JS Bug if no randombanners is not on page

parent 2f5a04ad
......@@ -7,8 +7,10 @@ var randombanners = {} || window.randombanners;
*/
randombanners.shuffle = function (element) {
$element = document.querySelector(element);
for (var i = $element.children.length; i >= 0; i--) {
$element.appendChild($element.children[Math.random() * i | 0]);
if ($($element).length > 0) {
for (var i = $element.children.length; i >= 0; i--) {
$element.appendChild($element.children[Math.random() * i | 0]);
}
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment