Update the `$container` declaration to `settings.locationElem` and leave this as it was.