return window vertical center postion offset by element's height

$.returnWinCenterPos = function(_el, _mode) { if (_el === undefined || !_el.length) return false; var _height = _el.height() || 0, _result = ($window.height() / 2) - (_height / 2); if (_el.css('position') !== 'absolute') { _result += $window.scrollTop(); } return _result; };

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.