Commit 3b8db002 authored by Boris Schauer's avatar Boris Schauer

[BUGFIX] JS error if banner plugin have no children

parent 7ee98d08
......@@ -7,8 +7,10 @@ var randombanners = {} || window.randombanners;
*/
randombanners.shuffle = function (element) {
$element = document.querySelector(element);
if ($($element).length > 0) {
for (var i = $element.children.length; i >= 0; i--) {
if ($(element).children.length) {
$element = document.querySelector(element);
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