Fin de phrase ignorée

danynous Messages postés 15 Date d'inscription mercredi 21 septembre 2005 Statut Membre Dernière intervention 13 mai 2012 - 30 avril 2012 à 11:37
danynous Messages postés 15 Date d'inscription mercredi 21 septembre 2005 Statut Membre Dernière intervention 13 mai 2012 - 13 mai 2012 à 11:08
Bonjour,
j'utilise ce script pour changer le fond de page sur les différentes pages de mon forum:

if(document.location.pathname=="/t1-test-message")
{
(function(a){a.backstretch=function(k,i,l){function m(c){try{g={left:0,top:0},d=e.width(),b=d/j,b>=e.height()?(h=(b-e.height())/2,f.centeredY&&a.extend(g,{top:"-"+h+"px"})):(b=e.height(),d=b*j,h=(d-e.width())/2,f.centeredX&&a.extend(g,{left:"-"+h+"px"})),a("#backstretch, #backstretch img:last").width(d).height(b).filter("img").css(g)}catch(o){}typeof c=="function"&&c()}var n={centeredX:!0,centeredY:!0,speed:0},c=a("#backstretch"),f=c.data("settings")||n;c.data("settings");var e="onorientationchange"in window?a(document):a(window),j,d,b,h,g;i&&typeof i=="object"&&a.extend(f,i);a(document).ready(function(){if(k){var b;c.length==0?c=a("
").attr("id","backstretch").css({left:0,top:0,position:"fixed",overflow:"hidden",zIndex:-999999,margin:0,padding:0,height:"100%",width:"100%"}):c.find("img").addClass("deleteable");b=a("").css({position:"absolute",display:"none",margin:0,padding:0,border:"none",zIndex:-999999}).bind("load",function(b){var d=a(this),e;d.css({width:"auto",height:"auto"}); e=this.width||a(b.target).width();b=this.height||a(b.target).height();j=e/b;m(function(){d.fadeIn(f.speed,function(){c.find(".deleteable").remove();typeof l=="function"&&l()})})}).appendTo(c);a("body #backstretch").length==0&&a("body").append(c);c.data("settings",f);b.attr("src",k);a(window).resize(m)}});return this}})(jQuery);$.backstretch("http://i44.servimg.com/u/f44/16/44/05/14/fond_210.jpg");
}

quand je passe à la seconde page de mon sujet l'adresse devient: /t1p5-test-message
donc le fond sélectionné ne fonctionne plus car ce n'est plus la même adresse; forcément!!

Comment serait'il possible de faire pour que la fin de l'adresse soit ignorée après /t1 j'ai essayé de mettre un astérisque /t1* mais cela ne marche pas
je vous remercie à l'avance

Cordialement
Danynou

3 réponses

@karamel Messages postés 1823 Date d'inscription vendredi 9 mai 2008 Statut Modérateur Dernière intervention 20 mars 2023 145
30 avril 2012 à 21:21
bonjour

utilise la balise code et fait des retours ligne car c'est illisible
0
danynous Messages postés 15 Date d'inscription mercredi 21 septembre 2005 Statut Membre Dernière intervention 13 mai 2012
1 mai 2012 à 11:15
Bonjour,
if(document.location.pathname=="/t1-test-message") 
{ 
(function(a){a.backstretch=function(k,i,l){function m(c){try{g={left:0,top:0},d=e.width(),b=d/j,b>=e.height()
?(h=(b-e.height())/2,f.centeredY&&a.extend(g,{top:"-"+h+"px"})):(b=e.height(),d=b*j,h=(d-e.width())/2,
f.centeredX&&a.extend(g,{left:"-"+h+"px"})),a("#backstretch, #backstretch img:last").width(d).height(b).filter("img")
.css(g)}catch(o){}typeof c=="function"&&c()}var n={centeredX:!0,centeredY:!0,speed:0},c=a("#backstretch"),f=c.data
("settings")||n;c.data("settings");var e="onorientationchange"in window?a(document):a(window),j,d,b,h,g;i&&
typeof i=="object"&&a.extend(f,i);a(document).ready(function(){if(k){var b;c.length==0?c=a("
").attr
("id","backstretch").css({left:0,top:0,position:"fixed",overflow:"hidden",zIndex:-999999,margin:0,padding:0
,height:"100%",width:"100%"}):c.find("img").addClass("deleteable");b=a("").css({position:"absolute",display:"none",margin:0,padding:0,border:
"none",zIndex:-999999}).bind("load",function(b){var d=a(this),e;d.css({width:"auto",height:"auto"});
e=this.width||a(b.target).width();b=this.height||a(b.target).height();j=e/b;m(function(){d.fadeIn(f.speed,function()
{c.find(".deleteable").remove();typeof l=="function"&&l()})})}).appendTo(c);a("body #backstretch").length==0&&a("body")
.append(c);c.data("settings",f);b.attr("src",k);a(window).resize(m)}});return this}})(jQuery);$.backstretch
("http://i44.servimg.com/u/f44/16/44/05/14/fond_210.jpg"); 
} 


je précise que ce code fonctionne, ce que je voudrais savoir :
Comment serait'il possible de faire pour que la fin de l'adresse soit ignorée après /t1 pour que le fond reste tant que le début de l'adresse est /t1
Merci
Danynou
0
danynous Messages postés 15 Date d'inscription mercredi 21 septembre 2005 Statut Membre Dernière intervention 13 mai 2012
13 mai 2012 à 11:08
Bonjour,

c'est bon j'ai trouvé, problème résolu
Cordialement

Danynou
0