MediaWiki:Vector.js : Différence entre versions
De Sciencinfolycee
(Lien SILO modifié) |
(Correction apportée par Indigen) |
||
Ligne 11 : | Ligne 11 : | ||
var center = function() { | var center = function() { | ||
var width = $(window).width(); | var width = $(window).width(); | ||
− | var left = (width - | + | var left = (width - 1100) / 2; |
$("#mw-head").css("left", left + "px"); | $("#mw-head").css("left", left + "px"); | ||
$("#mw-panel").css("left", left + "px"); | $("#mw-panel").css("left", left + "px"); | ||
− | $("#content").css("left", (left + | + | $("#content").css("left", (left + 280) + "px"); |
$("#content").css("height", (Math.max($("#content").height(), $("#mw-panel").height()) - 20) + "px"); | $("#content").css("height", (Math.max($("#content").height(), $("#mw-panel").height()) - 20) + "px"); | ||
$("#links").css("left", (linksLeft + left) + "px"); | $("#links").css("left", (linksLeft + left) + "px"); | ||
Ligne 21 : | Ligne 21 : | ||
center(); | center(); | ||
}); | }); | ||
− | |||
− | |||
− | |||
− |
Version du 14 octobre 2011 à 17:46
/* Any JavaScript here will be loaded for users using the Vector skin */ jQuery(document).ready(function($){ $(document).ready(function() { // Add header links var links = $("<div id='links'><a href='http://science-info-lycee.fr/une-equipe-a-votre-service/'>Le SILO</a><span>-</span><a class='selected' href=''>Ressources</a><span>-</span><a href='http://science-info-lycee.fr/le-forum/'>Echanger</a></div>"); $("body").prepend(links); // Center all elements; var linksLeft = parseInt($("#links").css("left")); var center = function() { var width = $(window).width(); var left = (width - 1100) / 2; $("#mw-head").css("left", left + "px"); $("#mw-panel").css("left", left + "px"); $("#content").css("left", (left + 280) + "px"); $("#content").css("height", (Math.max($("#content").height(), $("#mw-panel").height()) - 20) + "px"); $("#links").css("left", (linksLeft + left) + "px"); } $(window).resize(center); center(); });