Forum-webmaster
Technique - programmation => Javascript / DOM / Ajax => Message commencé par: cyndi21 le le 26-07-2013 a 06:50:34

Titre: bannière fixe qui suit scrollbar
Posté par: cyndi21 le le 26-07-2013 a 06:50:34

Bonjour

Je suis novice avec JS.
J'ai trouvé ce code-ci sur internet pour fixer ma scrollbal à gauche.
http://www.bonideecadeau.be/22-cadeaux-sexy-erotique (http://www.bonideecadeau.be/22-cadeaux-sexy-erotique)

Il y a 1 margin-top de 20px mais si on est sur un petit écran la bannière vient se mettre dans le footer. Pas très joli.

Voici le code JS
$(function () {

var msie6 = $.browser == 'msie' && $.browser.version < 7;

if (!msie6) {
var top = $('#sidebar').offset().top - parseFloat($('#sidebar').css('margin-top').replace(/auto/, 0));
$(window).scroll(function (event) {
// what the y position of the scroll is
var y = $(this).scrollTop();

// whether that's below the form
if (y >= top) {
// if so, ad the fixed class
$('#sidebar').addClass('fixed');
} else {
// otherwise remove it
$('#sidebar').removeClass('fixed');
}
});
}
});


ET le CSS
#sidebar.fixed{
position: fixed;
top:0;
margin-top:20px;
}
#sidebar{
z-index:5;
position:absolute;
top:1180px;
}

Que dois-je faire pour que l'image reste au dessus du footer donc il faudrait un margin-bottom de 300 px.

Merci de votre aide, je veux bien vous payer si vous savez m'aider.

Titre: Re:bannière fixe qui suit scrollbar
Posté par: GuillaumeRoos le le 26-07-2013 a 10:48:08

Bonjour,

Je vous envoie un MP.

Guillaume


Forum-webmaster | Actionné par YaBB SE
© 2001-2003, YaBB SE Dev Team. Tous droits réservés.