User:Equazcion/Floater2.js

loadJQViewport;

$('#mw-panel').css('z-index','9999');

$('#mw-head').clone(true) .addClass('floater') .css('position','fixed') .css('z-index','999') .css('top','0') .css('right','0') .css('width','100%') .css('background-color','white') .css('background-position','left bottom') .css('background-repeat','repeat-x') .css('background-image','url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAsCAIAAAArRUU2AAAAOklEQVQIHQXBAQEAAAjDIFz/zhdsCyE0y4SQya2RCSGWaYQ2Hc3ahFiINTIh1ly3NRohEwuh0VmmER5oBCM5OFSTKwAAAABJRU5ErkJggg==")') .css('height','80px') //.css('border-bottom','1px solid rgb(167, 215, 249)') .css('overflow','hidden') .appendTo('#mw-navigation') .find('#utcdate').remove; if ($('#mw-head li#utcdate').length > 0) $('#mw-head li#utcdate').appendTo('.floater #p-personal ul');

$('#mw-head').remove;

var floater = $('.floater');

$(window).scroll(function{	scroll; }); var cloneTitle = $('.firstHeading span[dir="auto"]').clone(true) .css('margin-top','2.85em') .css('margin-left','0.5em') .css('font-size','1.2em') .css('color','#333') //.css('text-shadow','1px 1px 5px #222') .css('float','left') //.css('opacity','0.7') .addClass('h2') .insertAfter('#left-navigation') .attr('hidden','');

function scroll{ if ($('.firstHeading:in-viewport').length < 1){ floater.css('opacity','0.9'); cloneTitle.prop('hidden', false); } else { floater.css('opacity','1'); cloneTitle.attr('hidden',''); } } function loadJQViewport{ /* Viewport - jQuery selectors for finding elements in viewport Copyright (c) 2008-2009 Mika Tuupola Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php * Project home: http://www.appelsiini.net/projects/viewport $(":in-viewport") $(":below-the-fold") $(":above-the-top") $(":left-of-screen") $(":right-of-screen") */ (function($) {		$.belowthefold = function(element, settings) {			var fold = $(window).height + $(window).scrollTop;			return fold <= $(element).offset.top - settings.threshold;		};		$.abovethetop = function(element, settings) {			var top = $(window).scrollTop;			return top >= $(element).offset.top + $(element).height - settings.threshold;		};		$.rightofscreen = function(element, settings) {			var fold = $(window).width + $(window).scrollLeft;			return fold <= $(element).offset.left - settings.threshold;		};		$.leftofscreen = function(element, settings) {			var left = $(window).scrollLeft;			return left >= $(element).offset.left + $(element).width - settings.threshold;		};		$.inviewport = function(element, settings) {			return !$.rightofscreen(element, settings) && !$.leftofscreen(element, settings) && !$.belowthefold(element, settings) && !$.abovethetop(element, settings); };		$.extend($.expr[':'], {			"below-the-fold": function(a, i, m) {				return $.belowthefold(a, {threshold : 0});			},			"above-the-top": function(a, i, m) {				return $.abovethetop(a, {threshold : 0});			},			"left-of-screen": function(a, i, m) {				return $.leftofscreen(a, {threshold : 0});			},			"right-of-screen": function(a, i, m) {				return $.rightofscreen(a, {threshold : 0});			},			"in-viewport": function(a, i, m) {				return $.inviewport(a, {threshold : 0});			}		}); })(jQuery); }