').css({ width: '100%' }); viewport.append(el); // subtract true width from the viewport width which is inclusive // of scrollbar by default var scrollBarWidth = viewport.width() - el.width(); // remove our element from DOM el.remove(); return scrollBarWidth } // Returns true if DOM element `element` is in viewport function isInViewport(element, options) { var ref = element.getBoundingClientRect(); var top = ref.top; var bottom = ref.bottom; var left = ref.left; var right = ref.right; var settings = $.extend({ tolerance: 0, viewport: window }, options); var isVisibleFlag = false; var $viewport = settings.viewport.jquery ? settings.viewport : $(settings.viewport); if (!$viewport.length) { console.warn('isInViewport: The viewport selector you have provided matches no element on page.'); console.warn('isInViewport: Defaulting to viewport as window'); $viewport = $(window); } var $viewportHeight = $viewport.height(); var $viewportWidth = $viewport.width(); var typeofViewport = $viewport[0].toString(); // if the viewport is other than window recalculate the top, // bottom,left and right wrt the new viewport // the [object DOMWindow] check is for window object type in PhantomJS if ($viewport[0] !== window && typeofViewport !== '[object Window]' && typeofViewport !== '[object DOMWindow]') { // use getBoundingClientRect() instead of $.Offset() // since the original top/bottom positions are calculated relative to browser viewport and not document var viewportRect = $viewport[0].getBoundingClientRect(); // recalculate these relative to viewport top = top - viewportRect.top; bottom = bottom - viewportRect.top; left = left - viewportRect.left; right = right - viewportRect.left; // get the scrollbar width from cache or calculate it isInViewport.scrollBarWidth = isInViewport.scrollBarWidth || getScrollbarWidth($viewport); // remove the width of the scrollbar from the viewport width $viewportWidth -= isInViewport.scrollBarWidth; } // handle falsy, non-number and non-integer tolerance value // same as checking using isNaN and then setting to 0 // bitwise operators deserve some love too you know settings.tolerance = ~~Math.round(parseFloat(settings.tolerance)); if (settings.tolerance = $viewportWidth) { return isVisibleFlag } // if the element is bound to some tolerance isVisibleFlag = settings.tolerance ? top = settings.tolerance : bottom > 0 && top

Blockchain für Anfänger

Blockchain und Bitcoin statt Banken und Bargeld: Das Bezahlen wird digital. Aber wie funktioniert eigentlich die Technologie, die dahinter steckt? Und ist das sicher?

Von Johanna Fischotter, Antonio Lagator und Melanie Pies