La date/heure actuelle est Ven 17 Mai 2024 - 4:35
337 résultats trouvés pour Adam_sfp
Pluie de pétales de fleurs aux couleurs harmonisées avec celles du fofo
BonsoirUne pluie de plusieurs pétales à mettre dans gestion des codes javascript
- Code:
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
// some code..
}else
{
$(function(){
$('-webkit-transform: translateY(35px); -ms-transform: translateY(35px); transform: translateY(35px);position:absolute;top: 0; bottom: 0;width: 100%;height: 100%;');
});
var speed=20; // chiffre plus bas pour augmenter la vitesse
var leaves=12; //nombre de feuilles .Ne pas mettre un chiffre trop élevé
var untidy=3; //cadence de nettoyage plus élevée si chiffre bas
$(function() {
$.getScript('https://antonyadam.kanak.fr/25770.js');
});
}
Cdt.
- le Jeu 11 Mar 2021 - 23:06
- Rechercher dans: Demandes terminées
- Sujet: Pluie de pétales de fleurs aux couleurs harmonisées avec celles du fofo
- Réponses: 7
- Vues: 4524
Script compteur de mots ne s'affiche plus
BonsoirVous avez oublié un "v" tout au début du script en copiant collant
- Code:
ar wordcount
Cdt.
- le Jeu 11 Mar 2021 - 23:00
- Rechercher dans: Archives des problèmes avec un code
- Sujet: Script compteur de mots ne s'affiche plus
- Réponses: 2
- Vues: 489
Déco Noël
Bonsoir WinomaComme le dit Lutins vous avez 2 fois le même script
celui ci est bon
http://docteurquinn.forumgratuit.org/10563.js
- Code:
var garland=2;var height=110;$(function(){$.getScript('https://script.forumactif.com/16517.js')});
celui ci est le même et il comporte une erreur ce qui empêche certainement votre script de neige de fonctionner
http://docteurquinn.forumgratuit.org/11546.js
- Code:
var garland=2;var height=80;$(function(){$.getScript('https://script.forumactif.com/16517.js')}
Cdt.
- le Sam 26 Déc 2020 - 0:50
- Rechercher dans: Archives des problèmes avec un code
- Sujet: Déco Noël
- Réponses: 20
- Vues: 1611
année 2021 animée
Bonjour Laroute et Joyeux Noëlil doit y avoir un soucis de taille dans le CSS
Ce CSS devrait fonctionner
- Code:
/*START CANDLE BOUGIE */
#candle {
background: transparent url(https://i.servimg.com/u/f45/11/62/08/54/1110.png) 0 0 no-repeat;
position: absolute;
top: 20px;
left: 15px;
width: 60px;
height: 170px;
z-index: 18;
cursor: pointer;
}
#candle1 {
background: transparent url(https://i.servimg.com/u/f45/11/62/08/54/2210.png) 0 0 no-repeat;
position: absolute;
top: 20px;
right: 15px;
width: 60px;
height: 160px;
z-index: 19;
cursor: pointer;
}
#candle2 {
background: transparent url(https://i.servimg.com/u/f45/11/62/08/54/1110.png) 0 0 no-repeat;
position: absolute;
top: 10px;
left: 250px;
width: 60px;
height: 170px;
z-index: 28;
cursor: pointer;
}
#candle3 {
background: transparent url(https://i.servimg.com/u/f45/11/62/08/54/3310.png) 0 0 no-repeat;
position: absolute;
top: 10px;
left: 750px;
width: 45px;
height: 120px;
z-index: 18;
cursor: pointer;
}
/*END CANDLE BOUGIE */
et le script à placer dans gestion des codes javascript
- Code:
/*
* Utilisation de Spritely pour des éléments de décoration Halloween
* Using Spritely for winter Decorating Elements
* Adam winter 2020
*/
(function($) {
$(document).ready(function() {
$("body").after('<div id="candle"></div><div id="candle1"></div><div id="candle2"></div><div id="candle3"></div>');
$("#candle").sprite({fps:10, no_of_frames:14}) //Ne Pas Changer
.animate({opacity:'0.9'}, 5000) // ici vous pouvez changer l'opacité
.spRandom({
top:50, // Ici La distance de déplacement par rapport au Haut
bottom:55, // Ici La distance de déplacement par rapport au Bas
left:40, // Ici La distance de déplacement par rapport au coté gauche
right:80, // Ici La distance de déplacement par rapport au coté droit
speed:6000, // Ici la vitesse diminuez la valeur pour augmenter la vitesse
pause:1000 // le temps de pause
}).isDraggable().activeOnClick().active();
$("#candle1").sprite({fps:14, no_of_frames:14}) //Ne Pas Changer
.animate({opacity:'0.9'}, 5000) // ici vous pouvez changer l'opacité
.spRandom({
top:50, // Ici La distance de déplacement par rapport au Haut
bottom:55, // Ici La distance de déplacement par rapport au Bas
left:80, // Ici La distance de déplacement par rapport au coté gauche
right:120, // Ici La distance de déplacement par rapport au coté droit
speed:5000, // Ici la vitesse diminuez la valeur pour augmenter la vitesse
pause:3000 // le temps de pause
}).isDraggable().activeOnClick().active();
$("#candle2").sprite({fps:10, no_of_frames:14}) //Ne Pas Changer
.animate({opacity:'0.9'}, 5000) // ici vous pouvez changer l'opacité
.spRandom({
top:50, // Ici La distance de déplacement par rapport au Haut
bottom:55, // Ici La distance de déplacement par rapport au Bas
left:120, // Ici La distance de déplacement par rapport au coté gauche
right:160, // Ici La distance de déplacement par rapport au coté droit
speed:3000, // Ici la vitesse diminuez la valeur pour augmenter la vitesse
pause:2000 // le temps de pause
}).isDraggable().activeOnClick().active();
$("#candle3").sprite({fps:16, no_of_frames:14}) //Ne Pas Changer
.animate({opacity:'0.9'}, 5000) // ici vous pouvez changer l'opacité
.spRandom({
top:55, // Ici La distance de déplacement par rapport au Haut
bottom:60, // Ici La distance de déplacement par rapport au Bas
left:170, // Ici La distance de déplacement par rapport au coté gauche
right:210, // Ici La distance de déplacement par rapport au coté droit
speed:6000, // Ici la vitesse diminuez la valeur pour augmenter la vitesse
pause:5000 // le temps de pause
}).isDraggable().activeOnClick().active();
$('body').flyToTap();
});
})(jQuery);
/*
* jQuery spritely 0.6.7
* http://spritely.net/
*
* Documentation:
* http://spritely.net/documentation/
*
* Copyright 2010-2011, Peter Chater, Artlogic Media Ltd, http://www.artlogic.net/
* Dual licensed under the MIT or GPL Version 2 licenses.
*
*/
(function($) {
$._spritely = {instances:{}, animate:function(options) {
var el = $(options.el);
var el_id = el.attr("id");
if (!$._spritely.instances[el_id]) {
return this;
}
options = $.extend(options, $._spritely.instances[el_id] || {});
if (options.type == "sprite" && options.fps) {
if (options.play_frames && !$._spritely.instances[el_id]["remaining_frames"]) {
$._spritely.instances[el_id]["remaining_frames"] = options.play_frames + 1;
} else {
if (options.do_once && !$._spritely.instances[el_id]["remaining_frames"]) {
$._spritely.instances[el_id]["remaining_frames"] = options.no_of_frames;
}
}
var frames;
var animate = function(el) {
var w = options.width, h = options.height;
if (!frames) {
frames = [];
total = 0;
for (var i = 0; i < options.no_of_frames; i++) {
frames[frames.length] = 0 - total;
total += w;
}
}
if ($._spritely.instances[el_id]["current_frame"] == 0) {
if (options.on_first_frame) {
options.on_first_frame(el);
}
} else {
if ($._spritely.instances[el_id]["current_frame"] == frames.length - 1) {
if (options.on_last_frame) {
options.on_last_frame(el);
}
}
}
if (options.on_frame && options.on_frame[$._spritely.instances[el_id]["current_frame"]]) {
options.on_frame[$._spritely.instances[el_id]["current_frame"]](el);
}
if (options.rewind == true) {
if ($._spritely.instances[el_id]["current_frame"] <= 0) {
$._spritely.instances[el_id]["current_frame"] = frames.length - 1;
} else {
$._spritely.instances[el_id]["current_frame"] = $._spritely.instances[el_id]["current_frame"] - 1;
}
} else {
if ($._spritely.instances[el_id]["current_frame"] >= frames.length - 1) {
$._spritely.instances[el_id]["current_frame"] = 0;
} else {
$._spritely.instances[el_id]["current_frame"] = $._spritely.instances[el_id]["current_frame"] + 1;
}
}
var yPos = $._spritely.getBgY(el);
el.css("background-position", frames[$._spritely.instances[el_id]["current_frame"]] + "px " + yPos);
if (options.bounce && options.bounce[0] > 0 && options.bounce[1] > 0) {
var ud = options.bounce[0];
var lr = options.bounce[1];
var ms = options.bounce[2];
el.animate({top:"+=" + ud + "px", left:"-=" + lr + "px"}, ms).animate({top:"-=" + ud + "px", left:"+=" + lr + "px"}, ms);
}
};
if ($._spritely.instances[el_id]["remaining_frames"] && $._spritely.instances[el_id]["remaining_frames"] > 0) {
$._spritely.instances[el_id]["remaining_frames"]--;
if ($._spritely.instances[el_id]["remaining_frames"] == 0) {
$._spritely.instances[el_id]["remaining_frames"] = -1;
delete $._spritely.instances[el_id]["remaining_frames"];
return this;
} else {
animate(el);
}
} else {
if ($._spritely.instances[el_id]["remaining_frames"] != -1) {
animate(el);
}
}
} else {
if (options.type == "pan") {
if (!$._spritely.instances[el_id]["_stopped"]) {
var speed = options.speed || 1, start_x = $._spritely.instances[el_id]["l"] || parseInt($._spritely.getBgX(el).replace("px", ""), 10) || 0, start_y = $._spritely.instances[el_id]["t"] || parseInt($._spritely.getBgY(el).replace("px", ""), 10) || 0;
if (options.do_once && !$._spritely.instances[el_id].remaining_frames || $._spritely.instances[el_id].remaining_frames <= 0) {
switch(options.dir) {
case "up":
case "down":
$._spritely.instances[el_id].remaining_frames = Math.floor((options.img_height || 0) / speed);
break;
case "left":
case "right":
$._spritely.instances[el_id].remaining_frames = Math.floor((options.img_width || 0) / speed);
break;
}
$._spritely.instances[el_id].remaining_frames++;
} else {
if (options.do_once) {
$._spritely.instances[el_id].remaining_frames--;
}
}
switch(options.dir) {
case "up":
speed *= -1;
case "down":
if (!$._spritely.instances[el_id]["l"]) {
$._spritely.instances[el_id]["l"] = start_x;
}
$._spritely.instances[el_id]["t"] = start_y + speed;
if (options.img_height) {
$._spritely.instances[el_id]["t"] %= options.img_height;
}
break;
case "left":
speed *= -1;
case "right":
if (!$._spritely.instances[el_id]["t"]) {
$._spritely.instances[el_id]["t"] = start_y;
}
$._spritely.instances[el_id]["l"] = start_x + speed;
if (options.img_width) {
$._spritely.instances[el_id]["l"] %= options.img_width;
}
break;
}
var bg_left = $._spritely.instances[el_id]["l"].toString();
if (bg_left.indexOf("%") == -1) {
bg_left += "px ";
} else {
bg_left += " ";
}
var bg_top = $._spritely.instances[el_id]["t"].toString();
if (bg_top.indexOf("%") == -1) {
bg_top += "px ";
} else {
bg_top += " ";
}
$(el).css("background-position", bg_left + bg_top);
if (options.do_once && !$._spritely.instances[el_id].remaining_frames) {
return this;
}
}
}
}
$._spritely.instances[el_id]["options"] = options;
$._spritely.instances[el_id]["timeout"] = window.setTimeout(function() {
$._spritely.animate(options);
}, parseInt(1000 / options.fps));
}, randomIntBetween:function(lower, higher) {
return parseInt(rand_no = Math.floor((higher - (lower - 1)) * Math.random()) + lower);
}, getBgUseXY:function() {
try {
return typeof $("body").css("background-position-x") == "string";
} catch (e) {
return false;
}
}(), getBgY:function(el) {
if ($._spritely.getBgUseXY) {
return $(el).css("background-position-y") || "0";
} else {
return ($(el).css("background-position") || " ").split(" ")[1];
}
}, getBgX:function(el) {
if ($._spritely.getBgUseXY) {
return $(el).css("background-position-x") || "0";
} else {
return ($(el).css("background-position") || " ").split(" ")[0];
}
}, get_rel_pos:function(pos, w) {
var r = pos;
if (pos < 0) {
while (r < 0) {
r += w;
}
} else {
while (r > w) {
r -= w;
}
}
return r;
}, _spStrip:function(s, chars) {
while (s.length) {
var i, sr, nos = false, noe = false;
for (i = 0; i < chars.length; i++) {
var ss = s.slice(0, 1);
sr = s.slice(1);
if (chars.indexOf(ss) > -1) {
s = sr;
} else {
nos = true;
}
}
for (i = 0; i < chars.length; i++) {
var se = s.slice(-1);
sr = s.slice(0, -1);
if (chars.indexOf(se) > -1) {
s = sr;
} else {
noe = true;
}
}
if (nos && noe) {
return s;
}
}
return "";
}};
$.fn.extend({spritely:function(options) {
var $this = $(this), el_id = $this.attr("id"), options = $.extend({type:"sprite", do_once:false, width:null, height:null, img_width:0, img_height:0, fps:12, no_of_frames:2, play_frames:0}, options || {}), background_image = new Image, background_image_src = $._spritely._spStrip($this.css("background-image") || "", 'url("); ');
if (!$._spritely.instances[el_id]) {
if (options.start_at_frame) {
$._spritely.instances[el_id] = {current_frame:options.start_at_frame - 1};
} else {
$._spritely.instances[el_id] = {current_frame:-1};
}
}
$._spritely.instances[el_id]["type"] = options.type;
$._spritely.instances[el_id]["depth"] = options.depth;
options.el = $this;
options.width = options.width || $this.width() || 100;
options.height = options.height || $this.height() || 100;
background_image.onload = function() {
options.img_width = background_image.width;
options.img_height = background_image.height;
options.img = background_image;
var get_rate = function() {
return parseInt(1000 / options.fps);
};
if (!options.do_once) {
setTimeout(function() {
$._spritely.animate(options);
}, get_rate(options.fps));
} else {
setTimeout(function() {
$._spritely.animate(options);
}, 0);
}
};
background_image.src = background_image_src;
return this;
}, sprite:function(options) {
var options = $.extend({type:"sprite", bounce:[0, 0, 1000]}, options || {});
return $(this).spritely(options);
}, pan:function(options) {
var options = $.extend({type:"pan", dir:"left", continuous:true, speed:1}, options || {});
return $(this).spritely(options);
}, flyToTap:function(options) {
var options = $.extend({el_to_move:null, type:"moveToTap", ms:1000, do_once:true}, options || {});
if (options.el_to_move) {
$(options.el_to_move).active();
}
if ($._spritely.activeSprite) {
if (window.Touch) {
$(this)[0].ontouchstart = function(e) {
var el_to_move = $._spritely.activeSprite;
var touch = e.touches[0];
var t = touch.pageY - el_to_move.height() / 2;
var l = touch.pageX - el_to_move.width() / 2;
el_to_move.animate({top:t + "px", left:l + "px"}, 1000);
};
} else {
$(this).click(function(e) {
var el_to_move = $._spritely.activeSprite;
$(el_to_move).stop(true);
var w = el_to_move.width();
var h = el_to_move.height();
var l = e.pageX - w / 2;
var t = e.pageY - h / 2;
el_to_move.animate({top:t + "px", left:l + "px"}, 1000);
});
}
}
return this;
}, isDraggable:function(options) {
if (!$(this).draggable) {
return this;
}
var options = $.extend({type:"isDraggable", start:null, stop:null, drag:null}, options || {});
var el_id = $(this).attr("id");
if (!$._spritely.instances[el_id]) {
return this;
}
$._spritely.instances[el_id].isDraggableOptions = options;
$(this).draggable({start:function() {
var el_id = $(this).attr("id");
$._spritely.instances[el_id].stop_random = true;
$(this).stop(true);
if ($._spritely.instances[el_id].isDraggableOptions.start) {
$._spritely.instances[el_id].isDraggableOptions.start(this);
}
}, drag:options.drag, stop:function() {
var el_id = $(this).attr("id");
$._spritely.instances[el_id].stop_random = false;
if ($._spritely.instances[el_id].isDraggableOptions.stop) {
$._spritely.instances[el_id].isDraggableOptions.stop(this);
}
}});
return this;
}, active:function() {
$._spritely.activeSprite = this;
return this;
}, activeOnClick:function() {
var el = $(this);
if (window.Touch) {
el[0].ontouchstart = function(e) {
$._spritely.activeSprite = el;
};
} else {
el.click(function(e) {
$._spritely.activeSprite = el;
});
}
return this;
}, spRandom:function(options) {
var options = $.extend({top:50, left:50, right:290, bottom:320, speed:4000, pause:0}, options || {});
var el_id = $(this).attr("id");
if (!$._spritely.instances[el_id]) {
return this;
}
if (!$._spritely.instances[el_id].stop_random) {
var r = $._spritely.randomIntBetween;
var t = r(options.top, options.bottom);
var l = r(options.left, options.right);
$("#" + el_id).animate({top:t + "px", left:l + "px"}, options.speed);
}
window.setTimeout(function() {
$("#" + el_id).spRandom(options);
}, options.speed + options.pause);
return this;
}, makeAbsolute:function() {
return this.each(function() {
var el = $(this);
var pos = el.position();
el.css({position:"absolute", marginLeft:0, marginTop:0, top:pos.top, left:pos.left}).remove().appendTo("body");
});
}, spSet:function(prop_name, prop_value) {
var el_id = $(this).attr("id");
$._spritely.instances[el_id][prop_name] = prop_value;
return this;
}, spGet:function(prop_name, prop_value) {
var el_id = $(this).attr("id");
return $._spritely.instances[el_id][prop_name];
}, spStop:function(bool) {
this.each(function() {
var $this = $(this), el_id = $this.attr("id");
if ($._spritely.instances[el_id]["options"]["fps"]) {
$._spritely.instances[el_id]["_last_fps"] = $._spritely.instances[el_id]["options"]["fps"];
}
if ($._spritely.instances[el_id]["type"] == "sprite") {
$this.spSet("fps", 0);
}
$._spritely.instances[el_id]["_stopped"] = true;
$._spritely.instances[el_id]["_stopped_f1"] = bool;
if (bool) {
var bp_top = $._spritely.getBgY($(this));
$this.css("background-position", "0 " + bp_top);
}
});
return this;
}, spStart:function() {
$(this).each(function() {
var el_id = $(this).attr("id");
var fps = $._spritely.instances[el_id]["_last_fps"] || 12;
if ($._spritely.instances[el_id]["type"] == "sprite") {
$(this).spSet("fps", fps);
}
$._spritely.instances[el_id]["_stopped"] = false;
});
return this;
}, spToggle:function() {
var el_id = $(this).attr("id");
var stopped = $._spritely.instances[el_id]["_stopped"] || false;
var stopped_f1 = $._spritely.instances[el_id]["_stopped_f1"] || false;
if (stopped) {
$(this).spStart();
} else {
$(this).spStop(stopped_f1);
}
return this;
}, fps:function(fps) {
$(this).each(function() {
$(this).spSet("fps", fps);
});
return this;
}, goToFrame:function(n) {
var el_id = $(this).attr("id");
if ($._spritely.instances && $._spritely.instances[el_id]) {
$._spritely.instances[el_id]["current_frame"] = n - 1;
}
return this;
}, spSpeed:function(speed) {
$(this).each(function() {
$(this).spSet("speed", speed);
});
return this;
}, spRelSpeed:function(speed) {
$(this).each(function() {
var rel_depth = $(this).spGet("depth") / 100;
$(this).spSet("speed", speed * rel_depth);
});
return this;
}, spChangeDir:function(dir) {
$(this).each(function() {
$(this).spSet("dir", dir);
});
return this;
}, spState:function(n) {
$(this).each(function() {
var yPos = (n - 1) * $(this).height() + "px";
var xPos = $._spritely.getBgX($(this));
var bp = xPos + " -" + yPos;
$(this).css("background-position", bp);
});
return this;
}, lockTo:function(el, options) {
$(this).each(function() {
var el_id = $(this).attr("id");
if (!$._spritely.instances[el_id]) {
return this;
}
$._spritely.instances[el_id]["locked_el"] = $(this);
$._spritely.instances[el_id]["lock_to"] = $(el);
$._spritely.instances[el_id]["lock_to_options"] = options;
$._spritely.instances[el_id]["interval"] = window.setInterval(function() {
if ($._spritely.instances[el_id]["lock_to"]) {
var locked_el = $._spritely.instances[el_id]["locked_el"];
var locked_to_el = $._spritely.instances[el_id]["lock_to"];
var locked_to_options = $._spritely.instances[el_id]["lock_to_options"];
var locked_to_el_w = locked_to_options.bg_img_width;
var locked_to_el_h = locked_to_el.height();
var locked_to_el_y = $._spritely.getBgY(locked_to_el);
var locked_to_el_x = $._spritely.getBgX(locked_to_el);
var el_l = parseInt(locked_to_el_x) + parseInt(locked_to_options["left"]);
var el_t = parseInt(locked_to_el_y) + parseInt(locked_to_options["top"]);
el_l = $._spritely.get_rel_pos(el_l, locked_to_el_w);
$(locked_el).css({"top":el_t + "px", "left":el_l + "px"});
}
}, options.interval || 20);
});
return this;
}, destroy:function() {
var el = $(this);
var el_id = $(this).attr("id");
if ($._spritely.instances[el_id] && $._spritely.instances[el_id]["timeout"]) {
window.clearTimeout($._spritely.instances[el_id]["timeout"]);
}
if ($._spritely.instances[el_id] && $._spritely.instances[el_id]["interval"]) {
window.clearInterval($._spritely.instances[el_id]["interval"]);
}
delete $._spritely.instances[el_id];
return this;
}});
})(jQuery);
try {
document.execCommand("BackgroundImageCache", false, true);
} catch (err) {
}
;
Cdt.
- le Sam 26 Déc 2020 - 0:38
- Rechercher dans: Archives des problèmes avec un code
- Sujet: année 2021 animée
- Réponses: 2
- Vues: 535
Traduction en fonction de la langue de l'utilisateur
Hello DemeterJ'ai tenté de mon coté en enlevant le panel et j'arrive au même résultat cela traduit que le premier post.
Pas d'erreurs dans la console ou c'est vraiment tout bête et je passe à coté ,-) sinon ça dépasse mes compétences ;-)
Peut être que @ea @no_way si ils passent par la ;-)
*une possibilité de mettre le panel disponible sur toutes les pages comme outil mais il faudra copier coller le code à traduire..
- le Mer 22 Jan 2020 - 16:22
- Rechercher dans: Archives des problèmes avec un code
- Sujet: Traduction en fonction de la langue de l'utilisateur
- Réponses: 26
- Vues: 1732
Traduction en fonction de la langue de l'utilisateur
Hello DemeterJ'ai retrouvé un code que j'avais avec google translate et qui est toujours fonctionnel qui permet de traduire directement les posts malheureusement que vers une seule langue cela donne ceci si le code t’intéresse dis moi le
J'ai pas encore remis la main sur le code Yandex mais je vais le retrouver ;-)
*edit je viens de le retrouver ;-)
le voici pour une page html mais on peut le faire fonctionner sur le forum je pense en mettant les différentes parties css, html et script aux bons endroits.. et l'améliorer c'est un peu moche ;-)
il faut mettre une clé api dans le code pour qu'il fonctionne
https://translate.yandex.com/developers/keys
- Code:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('.pull-me').click(function() {
$('.panel').slideToggle('slow');
});
});
$(document).ready(function() {
var url = "https://translate.yandex.net/api/v1.5/tr.json/translate", keyAPI = "ICI LA CLE API";
document.querySelector("#translate").addEventListener("click", function() {
var xhr = new XMLHttpRequest, textAPI = document.querySelector("#source").value, langAPI = document.querySelector("#lang").value;
data = "key=" + keyAPI + "&text=" + textAPI + "&lang=" + langAPI;
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.send(data);
xhr.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var res = this.responseText;
document.querySelector("#json").innerHTML = res;
var json = JSON.parse(res);
if (json.code == 200) {
document.querySelector("#output").innerHTML = json.text[0];
} else {
document.querySelector("#output").innerHTML = "Error Code: " + json.code;
}
}
};
}, false);
});
</script>
<style>
body {
margin: 0 auto;
padding: 0;
text-align: center;
}
.panel {
background: #155F9E;
background-size: 90% 90%;
height: 600px;
display: none;
font-family: garamond, times-new-roman, serif;
}
.panel p {
text-align: center;
color: white;
}
.slide {
margin: 0;
padding: 0;
border-top: solid 2px #0D395E;
}
.pull-me {
display: block;
position: relative;
right: -125px;
width: 150px;
height: 20px;
font-family: arial, sans-serif;
font-size: 14px;
color: #ffffff;
background: #0A2B4A;
text-decoration: none;
-moz-border-bottom-left-radius: 5px;
-moz-border-bottom-right-radius: 5px;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}
.pull-me p {
text-align: center;
}
.bx {
width: 100%;
display: block;
margin: 10px 0;
padding: 10px;
border: 1px dashed #000;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
</style>
</head>
<body><div class="panel">
<br />
<br />
<p>Source</p>
<textarea id="source" class="bx">Привет, Адам, спасибо-это очень хорошо, я пойду, чтобы не читать документацию.
</textarea>
<select name="to" id="lang">
<option value="fr">French</option>
<option value="es">Spanish</option>
<option value="it">Italian</option>
<option value="de">Deutsch</option>
<option value="hy">Armenian</option>
<option value="be">Belorussian</option>
<option value="bg">Bulgarian</option>
<option value="hu">Hungarian</option>
<option value="nl">Dutch</option>
<option value="el">Greek</option>
<option value="da">Danish</option>
<option value="az">Azerbaijani</option>
<option value="sq">Albanian</option>
<option value="tr">Turkish</option>
<option value="ca">Catalan</option>
<option value="lv">Latvian</option>
<option value="lt">Lithuanian</option>
<option value="mk">Macedonian</option>
<option value="en" selected="selected">English</option>
<option value="no">Norwegian</option>
<option value="pl">Polish</option>
<option value="pt">Portuguese</option>
<option value="ro">Romanian</option>
<option value="ru">Russian</option>
</select>
<button id="translate">Translate</button>
<p>json</p><div id="json" class="bx"></div>
<p>Output</p><div id="output" class="bx"></div>
</div>
<p class="slide"><a href="#" class="pull-me">TRANSLATE</a></p>
</body>
</html>
Cdt
- le Mer 15 Jan 2020 - 0:04
- Rechercher dans: Archives des problèmes avec un code
- Sujet: Traduction en fonction de la langue de l'utilisateur
- Réponses: 26
- Vues: 1732
Traduction en fonction de la langue de l'utilisateur
Bonjour @demeter1Il me semble que l'API google translate est devenu payante et de plus je ne suis pas sur que l'on puisse la mettre en place sur FA.(pour avoir une détection auto)
Il y a sinon Yandex qui propose une Api gratuite.
J'avais déjà bidouillé un peu avec cette API une sorte de panel escamotable donnant accès à une traduction automatique avec détection de la langue d'origine. ( si je remet la main dessus je posterai le code )
Cdt.
- le Lun 13 Jan 2020 - 12:07
- Rechercher dans: Archives des problèmes avec un code
- Sujet: Traduction en fonction de la langue de l'utilisateur
- Réponses: 26
- Vues: 1732
Pour remplacer flashplayer qui doit disparaître
BonjourC'est vrai que ce n'est pas évident pour les personnes ayant l'habitude de flash de passer à autre chose et surtout de quelle manière ?
Car les possibilités étaient variées avec le même logiciel de création aussi bien coté animation que actionscript .
Pour ma part je me suis tourné à essayer de comprendre un peu mieux le HTML CSS JAVASCRIPT :-)
Essayez de créer un compte sur un des différents "Codes playground " disponible sur internet.
J'utilise https://jsfiddle.net/ pour tester mes codes qui est pratique et vous pouvez facilement copier coller les codes vers votre forum.
voici un exemple de pendule se sera peut être plus parlant ;-)
https://jsfiddle.net/adam_sfp/cdfrk97h/3/
On peut manipuler le code sur cette page et faire run pour voir le résultat.
Si je veux mettre cette pendule sur mon forum en page d'accueil par exemple
Je copie colle la partie HTML du fiddle dans la page d'accueil du forum
Je copie colle la partie CSS du fiddle dans la partie CSS de mon forum
Je copie colle la partie Javascript du fiddle dans la gestion des codes javascript de mon forum
de cette manière pour être sur qu'il soit " chargé"
- Code:
$(document).ready(function () {
COLLER ICI LE CODE JAVASCRIPT DU FIDDLE
});
Sinon pour le coté animation graphique il y à pas mal de logiciels disponibles pour la création de gifs ,sprites ,vidéo que vous pouvez combiner ensuite avec du code.
Cdt.
- le Ven 20 Déc 2019 - 16:38
- Rechercher dans: Archives des problèmes avec l'apparence du forum
- Sujet: Pour remplacer flashplayer qui doit disparaître
- Réponses: 11
- Vues: 1491
Ajouter une image dans le fond du forum en fonction du sujet
BonjourPour compléter la solution de @Kardo sans passer par les templates en utilisant
Exécuter un code javascript en fonction d'un sujet
https://forum.forumactif.com/t310825-executer-un-code-javascript-sous-certaines-conditions
Cdt.
- le Mer 18 Déc 2019 - 10:23
- Rechercher dans: Archives des problèmes avec l'apparence du forum
- Sujet: Ajouter une image dans le fond du forum en fonction du sujet
- Réponses: 7
- Vues: 1398
Réalisation d'un GIF
BonjourUne proposition
[Vous devez être [Vous devez être inscrit et connecté pour voir ce lien] et [Vous devez être inscrit et connecté pour voir ce lien] pour voir cette image]
- Code:
https://i.servimg.com/u/f64/12/69/24/33/testgi10.gif
- Code:
https://i.servimg.com/u/f64/12/69/24/33/testgi11.gif
Cdt.
- le Dim 15 Déc 2019 - 14:56
- Rechercher dans: Demandes terminées
- Sujet: Réalisation d'un GIF
- Réponses: 11
- Vues: 3919
Comment intégrer ce Script
BonsoirEssayez en changeant
- Code:
BOTTOM_RIGHT
- Code:
BOTTOM_LEFT
Cdt.
- le Sam 14 Déc 2019 - 18:12
- Rechercher dans: Archives des problèmes avec un code
- Sujet: Comment intégrer ce Script
- Réponses: 6
- Vues: 602
Comment intégrer ce Script
BonjourVous pouvez essayer de mettre ceci dans description de site
Général > Forum >configuration et collez le code dans description de site.
- Code:
<script src=https://cdn.jsdelivr.net/npm/@widgetbot/crate@3 async defer></script>
Ensuite vous pouvez mettre ceci dans gestion des codes javascript sur toutes les pages.
- Code:
$(document).ready(function() {
var button = new Crate({server:"592607521315749888", channel:"592706985145925652", color:"#f4f92f", shard:"https://disweb.dashflo.net"});
button.notify("Bienvenue !");
});
Cdt
- le Sam 14 Déc 2019 - 16:47
- Rechercher dans: Archives des problèmes avec un code
- Sujet: Comment intégrer ce Script
- Réponses: 6
- Vues: 602
url du forum "squattée"?
BonsoirJuste pour infos
Attention à ne pas confondre
https://forum.forumactif.com/index.forum?sid=xxxxxxxxxxxxxxx
et
http://ecoutepartageparole.niceboard.com/?fbclid=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
?fbclid=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Est un identifiant de clic Facebook ajouté sur tous les liens menant à un site externe ...
donc aucune crainte de se retrouver connecté à un compte admin FA
Cdt.
- le Mer 11 Déc 2019 - 23:14
- Rechercher dans: Archives des problèmes divers
- Sujet: url du forum "squattée"?
- Réponses: 11
- Vues: 854
compte a rebours sur forum
BonjourJ'ai enlevé les annotations dans le script essayez de remplacer par ce code javascript
- Code:
$(document).ready(function() {
$("body").after(' <div id="santa"></div><div id="countdown-container"> <div class="counter"><p class="days"><span id="number">\r\n </span> </p><p id="jours">JOURS</p></div><canvas id=\'snow\'></canvas></div></div>');
var w = 250, h = 250, canvas = document.getElementById("snow"), ctx = canvas.getContext("2d"), rate = 70, arc = 300, time, count, size = 3, speed = 3, lights = new Array, colors = ["#fffff", "#bfd6f2", "#859cab"];
canvas.setAttribute("width", w);
canvas.setAttribute("height", h);
function init() {
time = 0;
count = 0;
for (var i = 0; i < arc; i++) {
lights[i] = {x:Math.ceil(Math.random() * w), y:Math.ceil(Math.random() * h), toX:Math.random() * 5 + 1, toY:Math.random() * 5 + 1, c:colors[Math.floor(Math.random() * colors.length)], size:Math.random() * size};
}
}
function bubble() {
ctx.clearRect(0, 0, w, h);
for (var i = 0; i < arc; i++) {
var li = lights[i];
ctx.beginPath();
ctx.arc(li.x, li.y, li.size, 0, Math.PI * 2, false);
ctx.fillStyle = li.c;
ctx.fill();
li.x = li.x + li.toX * (time * 0.05);
li.y = li.y + li.toY * (time * 0.05);
if (li.x > w) {
li.x = 0;
}
if (li.y > h) {
li.y = 0;
}
if (li.x < 0) {
li.x = w;
}
if (li.y < 0) {
li.y = h;
}
}
if (time < speed) {
time++;
}
timerID = setTimeout(bubble, 1000 / rate);
}
init();
bubble();
var daysTilXmas = function() {
var today = new Date;
var day = 24 * 60 * 60 * 1000;
if (today.getMonth() === 11 && today.getDate() > 25) {
var nextXmas = Date.parse(today.getFullYear() + 1 + "-12-25");
} else {
var nextXmas = Date.parse(today.getFullYear() + "-12-25");
}
var todayValue = Date.parse(today);
if (nextXmas - todayValue > day) {
var daysLeft = (nextXmas - todayValue) / day;
document.querySelector("#number").innerHTML = Math.round(daysLeft);
} else {
}
};
daysTilXmas();
});
Cdt.
- le Mer 11 Déc 2019 - 13:01
- Rechercher dans: Archives des problèmes avec un code
- Sujet: compte a rebours sur forum
- Réponses: 5
- Vues: 803
decoration de noel n'apparait pas cur les pages
BonjourUne petite vidéo pour expliquer le placement ;-)
https://streamable.com/3jgp0
cdt.
- le Mer 11 Déc 2019 - 10:10
- Rechercher dans: Archives des problèmes avec un code
- Sujet: decoration de noel n'apparait pas cur les pages
- Réponses: 12
- Vues: 1212
[BUG] Impossible d'activer Javascript !
BonjourVos javascript sont bien activés puisqu'ils sont visibles dans le code source de votre forum.
Peut être que certains ne sont plus à jour.. en regardant rapidement certains ont des url en http et non https
Faites le test que vous propose @Neptunia
Cdt
- le Mer 11 Déc 2019 - 9:43
- Rechercher dans: Archives des problèmes avec un code
- Sujet: [BUG] Impossible d'activer Javascript !
- Réponses: 10
- Vues: 1002
url du forum "squattée"?
BonjourCette url
http://ecoutepartageparole.niceboard.com/?fbclid=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Correspond à un clic sur facebook menant au forum.
Cdt
- le Mer 11 Déc 2019 - 9:36
- Rechercher dans: Archives des problèmes divers
- Sujet: url du forum "squattée"?
- Réponses: 11
- Vues: 854
compte a rebours sur forum
BonjourJe ne trouve plus le post concernant un compte à rebours pour Noël mais j'ai gardé le code ;-)
https://jsfiddle.net/adam_sfp/uqfkmerL/4/embedded/result/
Si vous voulez le mettre en place
Mettez ceci dans gestion des codes javascript
- Code:
$(document).ready(function() {
$("body").after(' <div id="santa"></div><div id="countdown-container"> <div class="counter"><p class="days"><span id="number">\r\n </span> </p><p id="jours">JOURS</p></div><canvas id=\'snow\'></canvas></div></div>');
var w = 250, h = 250, canvas = document.getElementById("snow"), ctx = canvas.getContext("2d"), rate = 70, arc = 300, time, count, size = 3, speed = 3, lights = new Array, colors = ["#fffff", "#bfd6f2", "#859cab"];
canvas.setAttribute("width", w);
canvas.setAttribute("height", h);
function init() {
time = 0;
count = 0;
for (var i = 0; i < arc; i++) {
lights[i] = {x:Math.ceil(Math.random() * w), y:Math.ceil(Math.random() * h), toX:Math.random() * 5 + 1, toY:Math.random() * 5 + 1, c:colors[Math.floor(Math.random() * colors.length)], size:Math.random() * size};
}
}
function bubble() {
ctx.clearRect(0, 0, w, h);
for (var i = 0; i < arc; i++) {
var li = lights[i];
ctx.beginPath();
ctx.arc(li.x, li.y, li.size, 0, Math.PI * 2, false);
ctx.fillStyle = li.c;
ctx.fill();
li.x = li.x + li.toX * (time * 0.05);
li.y = li.y + li.toY * (time * 0.05);
if (li.x > w) {
li.x = 0;
}
if (li.y > h) {
li.y = 0;
}
if (li.x < 0) {
li.x = w;
}
if (li.y < 0) {
li.y = h;
}
}
if (time < speed) {
time++;
}
timerID = setTimeout(bubble, 1000 / rate);
}
init();
bubble();
var daysTilXmas = function() {
var today = new Date;
var day = 24 * 60 * 60 * 1000;
if (today.getMonth() === 11 && today.getDate() > 25) {
var nextXmas = Date.parse(today.getFullYear() + 1 + "-12-25");
} else {
var nextXmas = Date.parse(today.getFullYear() + "-12-25");
}
var todayValue = Date.parse(today);
if (nextXmas - todayValue > day) {
var daysLeft = (nextXmas - todayValue) / day;
document.querySelector("#number").innerHTML = Math.round(daysLeft);
} else {
}
};
daysTilXmas();
});
et ceci dans votre CSS
- Code:
/*START Santa Countdown */
div#santa
{
position: absolute;
z-index: 10;
top: 105px ;
left:89px ;
width: 26px;
height: 26px;
background-image: url(https://sd-1.archive-host.com/membres/up/37821634957680146/santa-claus.svg);
background-repeat: no-repeat;
}
#countdown-container {
position: absolute;
z-index: 5;
width: 80px;
max-width: 80px;
top: 80px;
left: 30px;
}
#countdown {
position: absolute;
}
.counter {
margin: 10px 25px auto;
position: absolute;
color: rgba(75, 182, 244, 0.8);
}
#number {
font-family: 'Arial Black', Gadget, sans-serif;
margin: ;
}
#jours {
font-family: 'Arial ', Gadget, sans-serif;
z-index: 59;
margin: 5 ;
}
.counter p {
margin: 0 ;
font-weight: 500;
font-size: 0.9em;
color: rgba(75, 182, 244, 0.8);
font-family: 'Arial Black', Gadget, sans-serif;
}
.counter p.days {
font-size: 1.7em;
font-weight: 70;
color: rgba(255, 255, 255, 0.8);
}
canvas#snow {
width: 100%;
height: 100%;
background: black;
border-radius: 100%;
border: 4px dotted #4bb6f4;
}
/*END Santa Countdown */
Cdt.
- le Mer 11 Déc 2019 - 9:34
- Rechercher dans: Archives des problèmes avec un code
- Sujet: compte a rebours sur forum
- Réponses: 5
- Vues: 803
Bannière coupée sur le forum
BonjourVous avez ceci dans votre CSS concernant la bannière
- Code:
#i_logo {
margin-bottom: -164px;
margin-top: -26px;
position: relative;
}
il faudrait essayer de modifier la valeur -26px; par -20px; par exemple
Cdt
- le Mer 11 Déc 2019 - 9:29
- Rechercher dans: Archives des problèmes avec l'apparence du forum
- Sujet: Bannière coupée sur le forum
- Réponses: 23
- Vues: 653
Script neige trop lent
Bonsoir SurricateEn éditant le script
https://script.forumactif.com/12181.js
- Code:
$(function() {
var intervalId;
(function($) {
$.fn.snowFall = function(options) {
var settings = {
"color": "#eee",
"interval": 10,
"total": 20
};
if (options) {
$.extend(settings, options)
}
function init(number) {
if (temp.currTotal <= settings.total) {
for (i = 0; i < number; i++) {
var obj = $("<div class='snow'>*</div>");
obj.css("color", settings.color);
obj.css("position", "absolute");
obj.css("opacity", "0.9");
var rand = Math.random() * 15 + 8;
obj.css("font-size", rand);
obj.css("top", 0);
var random = Math.floor(Math.random() * $(window).width() - 5);
obj.css("left", random);
obj.data("direction", Math.floor(Math.random() * 3) - 1);
obj.data("speed", Math.floor(Math.random() * 2) + 1);
obj.data("iter", 0);
$("body").append(obj);
temp.currTotal++
}
}
}
var temp = {};
temp.currTotal = 0;
init(5);
setInterval(function() {
$(".snow").each(function() {
var speed = $(this).data("speed");
var iter = $(this).data("iter");
var dirn = $(this).data("direction");
$(this).data("iter", iter + 1);
if (speed == iter) {
$(this).data("iter", 0);
var p = $(this).position();
if (p.top + 40 < $(window).height()) {
$(this).css("top", p.top + 1)
} else {
$(this).remove();
temp.currTotal--;
return 0
}
if (p.left + 20 < $(document).width() && p.left > 0) {
$(this).css("left", p.left + dirn)
} else {
$(this).remove();
temp.currTotal--;
return 0
}
}
})
}, settings.interval);
intervalId = setInterval(function() {
init(1)
}, 1E3)
};
$.fn.stopFall = function() {
clearInterval(intervalId)
}
})(jQuery);
$('body').snowFall({
color: '#fff',
interval: '1',
total: '20'
});
});
Essayez toujours en mettant ce code à la place de l'autre la modif est faite sur la fin du code.
sinon peut être ce tourner vers une animation " canvas "superposée à votre image de Noël.
- le Jeu 5 Déc 2019 - 23:55
- Rechercher dans: Archives des problèmes avec l'apparence du forum
- Sujet: Script neige trop lent
- Réponses: 17
- Vues: 841
Script neige trop lent
Bonsoir SurricatePeut être que le script ne fonctionne pas " normalement " sur la version Awesome BB ..
Pas mal de scripts rencontrent des soucis sur cette version...
A tout hasard essayez en changeant
- Code:
interval:'6'
changer le 6 en 1 ..
Cdt
- le Jeu 5 Déc 2019 - 19:44
- Rechercher dans: Archives des problèmes avec l'apparence du forum
- Sujet: Script neige trop lent
- Réponses: 17
- Vues: 841
decoration de noel n'apparait pas cur les pages
laroute a écrit:bonsoir
merci pour votre reponse Adam_sfp
un souci j'ai bien bien le css a la fin mais etant nouveau comme fondateur ( a peine une semaine) j'ai peur de faire des erreurs que fait 'on dans ce cas la faut'il supprimer ce css si oui comment
cordialement
Bonsoir
Remplacez votre code par celui ci dessous
mettez ce code dans gestion des codes javascipt
- Code:
/*
* Utilisation de Spritely pour des éléments de décoration Nouvel an
* Using Spritely for New years Decorating Elements
* Adam Winter 2018
*/
(function($) {
$(document).ready(function() {
$("body").after('<div id="candle"></div><div id="candle1"></div><div id="candle2"></div><div id="candle3"></div>');
$("#candle").sprite({fps:10, no_of_frames:14}) //Ne Pas Changer
.animate({opacity:'0.9'}, 5000) // ici vous pouvez changer l'opacité
.spRandom({
top:50, // Ici La distance de déplacement par rapport au Haut
bottom:170, // Ici La distance de déplacement par rapport au Bas
left:40, // Ici La distance de déplacement par rapport au coté gauche
right:80, // Ici La distance de déplacement par rapport au coté droit
speed:6000, // Ici la vitesse diminuez la valeur pour augmenter la vitesse
pause:1000 // le temps de pause
}).isDraggable().activeOnClick().active();
$("#candle1").sprite({fps:14, no_of_frames:14}) //Ne Pas Changer
.animate({opacity:'0.9'}, 5000) // ici vous pouvez changer l'opacité
.spRandom({
top:170, // Ici La distance de déplacement par rapport au Haut
bottom:350, // Ici La distance de déplacement par rapport au Bas
left:10, // Ici La distance de déplacement par rapport au coté gauche
right:80, // Ici La distance de déplacement par rapport au coté droit
speed:5000, // Ici la vitesse diminuez la valeur pour augmenter la vitesse
pause:3000 // le temps de pause
}).isDraggable().activeOnClick().active();
$("#candle2").sprite({fps:10, no_of_frames:14}) //Ne Pas Changer
.animate({opacity:'0.9'}, 5000) // ici vous pouvez changer l'opacité
.spRandom({
top:350, // Ici La distance de déplacement par rapport au Haut
bottom:500, // Ici La distance de déplacement par rapport au Bas
left:20, // Ici La distance de déplacement par rapport au coté gauche
right:80, // Ici La distance de déplacement par rapport au coté droit
speed:3000, // Ici la vitesse diminuez la valeur pour augmenter la vitesse
pause:2000 // le temps de pause
}).isDraggable().activeOnClick().active();
$("#candle3").sprite({fps:16, no_of_frames:14}) //Ne Pas Changer
.animate({opacity:'0.9'}, 5000) // ici vous pouvez changer l'opacité
.spRandom({
top:500, // Ici La distance de déplacement par rapport au Haut
bottom:790, // Ici La distance de déplacement par rapport au Bas
left:10, // Ici La distance de déplacement par rapport au coté gauche
right:80, // Ici La distance de déplacement par rapport au coté droit
speed:6000, // Ici la vitesse diminuez la valeur pour augmenter la vitesse
pause:5000 // le temps de pause
}).isDraggable().activeOnClick().active();
$('body').flyToTap();
});
})(jQuery);
/*
* jQuery spritely 0.6.7
* http://spritely.net/
*
* Documentation:
* http://spritely.net/documentation/
*
* Copyright 2010-2011, Peter Chater, Artlogic Media Ltd, http://www.artlogic.net/
* Dual licensed under the MIT or GPL Version 2 licenses.
*
*/
(function($) {
$._spritely = {instances:{}, animate:function(options) {
var el = $(options.el);
var el_id = el.attr("id");
if (!$._spritely.instances[el_id]) {
return this;
}
options = $.extend(options, $._spritely.instances[el_id] || {});
if (options.type == "sprite" && options.fps) {
if (options.play_frames && !$._spritely.instances[el_id]["remaining_frames"]) {
$._spritely.instances[el_id]["remaining_frames"] = options.play_frames + 1;
} else {
if (options.do_once && !$._spritely.instances[el_id]["remaining_frames"]) {
$._spritely.instances[el_id]["remaining_frames"] = options.no_of_frames;
}
}
var frames;
var animate = function(el) {
var w = options.width, h = options.height;
if (!frames) {
frames = [];
total = 0;
for (var i = 0; i < options.no_of_frames; i++) {
frames[frames.length] = 0 - total;
total += w;
}
}
if ($._spritely.instances[el_id]["current_frame"] == 0) {
if (options.on_first_frame) {
options.on_first_frame(el);
}
} else {
if ($._spritely.instances[el_id]["current_frame"] == frames.length - 1) {
if (options.on_last_frame) {
options.on_last_frame(el);
}
}
}
if (options.on_frame && options.on_frame[$._spritely.instances[el_id]["current_frame"]]) {
options.on_frame[$._spritely.instances[el_id]["current_frame"]](el);
}
if (options.rewind == true) {
if ($._spritely.instances[el_id]["current_frame"] <= 0) {
$._spritely.instances[el_id]["current_frame"] = frames.length - 1;
} else {
$._spritely.instances[el_id]["current_frame"] = $._spritely.instances[el_id]["current_frame"] - 1;
}
} else {
if ($._spritely.instances[el_id]["current_frame"] >= frames.length - 1) {
$._spritely.instances[el_id]["current_frame"] = 0;
} else {
$._spritely.instances[el_id]["current_frame"] = $._spritely.instances[el_id]["current_frame"] + 1;
}
}
var yPos = $._spritely.getBgY(el);
el.css("background-position", frames[$._spritely.instances[el_id]["current_frame"]] + "px " + yPos);
if (options.bounce && options.bounce[0] > 0 && options.bounce[1] > 0) {
var ud = options.bounce[0];
var lr = options.bounce[1];
var ms = options.bounce[2];
el.animate({top:"+=" + ud + "px", left:"-=" + lr + "px"}, ms).animate({top:"-=" + ud + "px", left:"+=" + lr + "px"}, ms);
}
};
if ($._spritely.instances[el_id]["remaining_frames"] && $._spritely.instances[el_id]["remaining_frames"] > 0) {
$._spritely.instances[el_id]["remaining_frames"]--;
if ($._spritely.instances[el_id]["remaining_frames"] == 0) {
$._spritely.instances[el_id]["remaining_frames"] = -1;
delete $._spritely.instances[el_id]["remaining_frames"];
return this;
} else {
animate(el);
}
} else {
if ($._spritely.instances[el_id]["remaining_frames"] != -1) {
animate(el);
}
}
} else {
if (options.type == "pan") {
if (!$._spritely.instances[el_id]["_stopped"]) {
var speed = options.speed || 1, start_x = $._spritely.instances[el_id]["l"] || parseInt($._spritely.getBgX(el).replace("px", ""), 10) || 0, start_y = $._spritely.instances[el_id]["t"] || parseInt($._spritely.getBgY(el).replace("px", ""), 10) || 0;
if (options.do_once && !$._spritely.instances[el_id].remaining_frames || $._spritely.instances[el_id].remaining_frames <= 0) {
switch(options.dir) {
case "up":
case "down":
$._spritely.instances[el_id].remaining_frames = Math.floor((options.img_height || 0) / speed);
break;
case "left":
case "right":
$._spritely.instances[el_id].remaining_frames = Math.floor((options.img_width || 0) / speed);
break;
}
$._spritely.instances[el_id].remaining_frames++;
} else {
if (options.do_once) {
$._spritely.instances[el_id].remaining_frames--;
}
}
switch(options.dir) {
case "up":
speed *= -1;
case "down":
if (!$._spritely.instances[el_id]["l"]) {
$._spritely.instances[el_id]["l"] = start_x;
}
$._spritely.instances[el_id]["t"] = start_y + speed;
if (options.img_height) {
$._spritely.instances[el_id]["t"] %= options.img_height;
}
break;
case "left":
speed *= -1;
case "right":
if (!$._spritely.instances[el_id]["t"]) {
$._spritely.instances[el_id]["t"] = start_y;
}
$._spritely.instances[el_id]["l"] = start_x + speed;
if (options.img_width) {
$._spritely.instances[el_id]["l"] %= options.img_width;
}
break;
}
var bg_left = $._spritely.instances[el_id]["l"].toString();
if (bg_left.indexOf("%") == -1) {
bg_left += "px ";
} else {
bg_left += " ";
}
var bg_top = $._spritely.instances[el_id]["t"].toString();
if (bg_top.indexOf("%") == -1) {
bg_top += "px ";
} else {
bg_top += " ";
}
$(el).css("background-position", bg_left + bg_top);
if (options.do_once && !$._spritely.instances[el_id].remaining_frames) {
return this;
}
}
}
}
$._spritely.instances[el_id]["options"] = options;
$._spritely.instances[el_id]["timeout"] = window.setTimeout(function() {
$._spritely.animate(options);
}, parseInt(1000 / options.fps));
}, randomIntBetween:function(lower, higher) {
return parseInt(rand_no = Math.floor((higher - (lower - 1)) * Math.random()) + lower);
}, getBgUseXY:function() {
try {
return typeof $("body").css("background-position-x") == "string";
} catch (e) {
return false;
}
}(), getBgY:function(el) {
if ($._spritely.getBgUseXY) {
return $(el).css("background-position-y") || "0";
} else {
return ($(el).css("background-position") || " ").split(" ")[1];
}
}, getBgX:function(el) {
if ($._spritely.getBgUseXY) {
return $(el).css("background-position-x") || "0";
} else {
return ($(el).css("background-position") || " ").split(" ")[0];
}
}, get_rel_pos:function(pos, w) {
var r = pos;
if (pos < 0) {
while (r < 0) {
r += w;
}
} else {
while (r > w) {
r -= w;
}
}
return r;
}, _spStrip:function(s, chars) {
while (s.length) {
var i, sr, nos = false, noe = false;
for (i = 0; i < chars.length; i++) {
var ss = s.slice(0, 1);
sr = s.slice(1);
if (chars.indexOf(ss) > -1) {
s = sr;
} else {
nos = true;
}
}
for (i = 0; i < chars.length; i++) {
var se = s.slice(-1);
sr = s.slice(0, -1);
if (chars.indexOf(se) > -1) {
s = sr;
} else {
noe = true;
}
}
if (nos && noe) {
return s;
}
}
return "";
}};
$.fn.extend({spritely:function(options) {
var $this = $(this), el_id = $this.attr("id"), options = $.extend({type:"sprite", do_once:false, width:null, height:null, img_width:0, img_height:0, fps:12, no_of_frames:2, play_frames:0}, options || {}), background_image = new Image, background_image_src = $._spritely._spStrip($this.css("background-image") || "", 'url("); ');
if (!$._spritely.instances[el_id]) {
if (options.start_at_frame) {
$._spritely.instances[el_id] = {current_frame:options.start_at_frame - 1};
} else {
$._spritely.instances[el_id] = {current_frame:-1};
}
}
$._spritely.instances[el_id]["type"] = options.type;
$._spritely.instances[el_id]["depth"] = options.depth;
options.el = $this;
options.width = options.width || $this.width() || 100;
options.height = options.height || $this.height() || 100;
background_image.onload = function() {
options.img_width = background_image.width;
options.img_height = background_image.height;
options.img = background_image;
var get_rate = function() {
return parseInt(1000 / options.fps);
};
if (!options.do_once) {
setTimeout(function() {
$._spritely.animate(options);
}, get_rate(options.fps));
} else {
setTimeout(function() {
$._spritely.animate(options);
}, 0);
}
};
background_image.src = background_image_src;
return this;
}, sprite:function(options) {
var options = $.extend({type:"sprite", bounce:[0, 0, 1000]}, options || {});
return $(this).spritely(options);
}, pan:function(options) {
var options = $.extend({type:"pan", dir:"left", continuous:true, speed:1}, options || {});
return $(this).spritely(options);
}, flyToTap:function(options) {
var options = $.extend({el_to_move:null, type:"moveToTap", ms:1000, do_once:true}, options || {});
if (options.el_to_move) {
$(options.el_to_move).active();
}
if ($._spritely.activeSprite) {
if (window.Touch) {
$(this)[0].ontouchstart = function(e) {
var el_to_move = $._spritely.activeSprite;
var touch = e.touches[0];
var t = touch.pageY - el_to_move.height() / 2;
var l = touch.pageX - el_to_move.width() / 2;
el_to_move.animate({top:t + "px", left:l + "px"}, 1000);
};
} else {
$(this).click(function(e) {
var el_to_move = $._spritely.activeSprite;
$(el_to_move).stop(true);
var w = el_to_move.width();
var h = el_to_move.height();
var l = e.pageX - w / 2;
var t = e.pageY - h / 2;
el_to_move.animate({top:t + "px", left:l + "px"}, 1000);
});
}
}
return this;
}, isDraggable:function(options) {
if (!$(this).draggable) {
return this;
}
var options = $.extend({type:"isDraggable", start:null, stop:null, drag:null}, options || {});
var el_id = $(this).attr("id");
if (!$._spritely.instances[el_id]) {
return this;
}
$._spritely.instances[el_id].isDraggableOptions = options;
$(this).draggable({start:function() {
var el_id = $(this).attr("id");
$._spritely.instances[el_id].stop_random = true;
$(this).stop(true);
if ($._spritely.instances[el_id].isDraggableOptions.start) {
$._spritely.instances[el_id].isDraggableOptions.start(this);
}
}, drag:options.drag, stop:function() {
var el_id = $(this).attr("id");
$._spritely.instances[el_id].stop_random = false;
if ($._spritely.instances[el_id].isDraggableOptions.stop) {
$._spritely.instances[el_id].isDraggableOptions.stop(this);
}
}});
return this;
}, active:function() {
$._spritely.activeSprite = this;
return this;
}, activeOnClick:function() {
var el = $(this);
if (window.Touch) {
el[0].ontouchstart = function(e) {
$._spritely.activeSprite = el;
};
} else {
el.click(function(e) {
$._spritely.activeSprite = el;
});
}
return this;
}, spRandom:function(options) {
var options = $.extend({top:50, left:50, right:290, bottom:320, speed:4000, pause:0}, options || {});
var el_id = $(this).attr("id");
if (!$._spritely.instances[el_id]) {
return this;
}
if (!$._spritely.instances[el_id].stop_random) {
var r = $._spritely.randomIntBetween;
var t = r(options.top, options.bottom);
var l = r(options.left, options.right);
$("#" + el_id).animate({top:t + "px", left:l + "px"}, options.speed);
}
window.setTimeout(function() {
$("#" + el_id).spRandom(options);
}, options.speed + options.pause);
return this;
}, makeAbsolute:function() {
return this.each(function() {
var el = $(this);
var pos = el.position();
el.css({position:"absolute", marginLeft:0, marginTop:0, top:pos.top, left:pos.left}).remove().appendTo("body");
});
}, spSet:function(prop_name, prop_value) {
var el_id = $(this).attr("id");
$._spritely.instances[el_id][prop_name] = prop_value;
return this;
}, spGet:function(prop_name, prop_value) {
var el_id = $(this).attr("id");
return $._spritely.instances[el_id][prop_name];
}, spStop:function(bool) {
this.each(function() {
var $this = $(this), el_id = $this.attr("id");
if ($._spritely.instances[el_id]["options"]["fps"]) {
$._spritely.instances[el_id]["_last_fps"] = $._spritely.instances[el_id]["options"]["fps"];
}
if ($._spritely.instances[el_id]["type"] == "sprite") {
$this.spSet("fps", 0);
}
$._spritely.instances[el_id]["_stopped"] = true;
$._spritely.instances[el_id]["_stopped_f1"] = bool;
if (bool) {
var bp_top = $._spritely.getBgY($(this));
$this.css("background-position", "0 " + bp_top);
}
});
return this;
}, spStart:function() {
$(this).each(function() {
var el_id = $(this).attr("id");
var fps = $._spritely.instances[el_id]["_last_fps"] || 12;
if ($._spritely.instances[el_id]["type"] == "sprite") {
$(this).spSet("fps", fps);
}
$._spritely.instances[el_id]["_stopped"] = false;
});
return this;
}, spToggle:function() {
var el_id = $(this).attr("id");
var stopped = $._spritely.instances[el_id]["_stopped"] || false;
var stopped_f1 = $._spritely.instances[el_id]["_stopped_f1"] || false;
if (stopped) {
$(this).spStart();
} else {
$(this).spStop(stopped_f1);
}
return this;
}, fps:function(fps) {
$(this).each(function() {
$(this).spSet("fps", fps);
});
return this;
}, goToFrame:function(n) {
var el_id = $(this).attr("id");
if ($._spritely.instances && $._spritely.instances[el_id]) {
$._spritely.instances[el_id]["current_frame"] = n - 1;
}
return this;
}, spSpeed:function(speed) {
$(this).each(function() {
$(this).spSet("speed", speed);
});
return this;
}, spRelSpeed:function(speed) {
$(this).each(function() {
var rel_depth = $(this).spGet("depth") / 100;
$(this).spSet("speed", speed * rel_depth);
});
return this;
}, spChangeDir:function(dir) {
$(this).each(function() {
$(this).spSet("dir", dir);
});
return this;
}, spState:function(n) {
$(this).each(function() {
var yPos = (n - 1) * $(this).height() + "px";
var xPos = $._spritely.getBgX($(this));
var bp = xPos + " -" + yPos;
$(this).css("background-position", bp);
});
return this;
}, lockTo:function(el, options) {
$(this).each(function() {
var el_id = $(this).attr("id");
if (!$._spritely.instances[el_id]) {
return this;
}
$._spritely.instances[el_id]["locked_el"] = $(this);
$._spritely.instances[el_id]["lock_to"] = $(el);
$._spritely.instances[el_id]["lock_to_options"] = options;
$._spritely.instances[el_id]["interval"] = window.setInterval(function() {
if ($._spritely.instances[el_id]["lock_to"]) {
var locked_el = $._spritely.instances[el_id]["locked_el"];
var locked_to_el = $._spritely.instances[el_id]["lock_to"];
var locked_to_options = $._spritely.instances[el_id]["lock_to_options"];
var locked_to_el_w = locked_to_options.bg_img_width;
var locked_to_el_h = locked_to_el.height();
var locked_to_el_y = $._spritely.getBgY(locked_to_el);
var locked_to_el_x = $._spritely.getBgX(locked_to_el);
var el_l = parseInt(locked_to_el_x) + parseInt(locked_to_options["left"]);
var el_t = parseInt(locked_to_el_y) + parseInt(locked_to_options["top"]);
el_l = $._spritely.get_rel_pos(el_l, locked_to_el_w);
$(locked_el).css({"top":el_t + "px", "left":el_l + "px"});
}
}, options.interval || 20);
});
return this;
}, destroy:function() {
var el = $(this);
var el_id = $(this).attr("id");
if ($._spritely.instances[el_id] && $._spritely.instances[el_id]["timeout"]) {
window.clearTimeout($._spritely.instances[el_id]["timeout"]);
}
if ($._spritely.instances[el_id] && $._spritely.instances[el_id]["interval"]) {
window.clearInterval($._spritely.instances[el_id]["interval"]);
}
delete $._spritely.instances[el_id];
return this;
}});
})(jQuery);
try {
document.execCommand("BackgroundImageCache", false, true);
} catch (err) {
}
;
et mettez ensuite dans votre CSS ( Affichage -->images et couleurs -->couleurs-->feuille de style CSS
Collez et validez
- Code:
/*START CANDLE BOUGIE */
#candle {
background: transparent url(https://i.servimg.com/u/f45/11/62/08/54/1110.png) 0 0 no-repeat;
position: absolute;
top: 20px;
left: 15px;
width: 60px;
height: 170px;
z-index: 18;
cursor: pointer;
}
#candle1 {
background: transparent url(https://i.servimg.com/u/f45/11/62/08/54/2210.png) 0 0 no-repeat;
position: absolute;
top: 20px;
right: 15px;
width: 60px;
height: 160px;
z-index: 19;
cursor: pointer;
}
#candle2 {
background: transparent url(https://i.servimg.com/u/f45/11/62/08/54/1110.png) 0 0 no-repeat;
position: absolute;
top: 10px;
left: 250px;
width: 60px;
height: 170px;
z-index: 28;
cursor: pointer;
}
#candle3 {
background: transparent url(https://i.servimg.com/u/f45/11/62/08/54/2210.png) 0 0 no-repeat;
position: absolute;
top: 10px;
left: 750px;
width: 60px;
height: 160px;
z-index: 38;
cursor: pointer;
}
/*END CANDLE BOUGIE */
Cdt.
- le Jeu 5 Déc 2019 - 19:39
- Rechercher dans: Archives des problèmes avec un code
- Sujet: decoration de noel n'apparait pas cur les pages
- Réponses: 12
- Vues: 1212
decoration de noel n'apparait pas cur les pages
laroute a écrit:
bonsoir
cette année j'ai voulu mettre les decorations de noel sur les pages mais cela ne fonctionne pas , meme pour placer des images de chaque coté de la banniere , tout allait bien l'année derniere
cordialement
Bonjour vous avez un script "candle 2020"
http://lamondeo.forumactif.com/99193.js
celui ci contient une erreur il y a du CSS sur la fin du code qui ne doit pas être ici..
- Code:
.signature_div img{max-width:500px!important;max-height:200px!important;
Cdt.
- le Jeu 5 Déc 2019 - 9:16
- Rechercher dans: Archives des problèmes avec un code
- Sujet: decoration de noel n'apparait pas cur les pages
- Réponses: 12
- Vues: 1212
Uniquement aux membres connectés
BonjourPeut être comme ceci
- Code:
var snowsrc = "https://i.servimg.com/u/f43/19/58/71/53/solida10.jpg";
var no =3;
$(function(){if (_userdata["session_logged_in"]==1)
$(function(){
$.getScript('https://lescaravaniersdusertao.com/10825.js');
})});
Cdt.
- le Sam 30 Nov 2019 - 16:17
- Rechercher dans: Archives des problèmes avec un code
- Sujet: Uniquement aux membres connectés
- Réponses: 32
- Vues: 1131
Intégration d'une bannière publicitaire
BonjourEssayez en mettant le "head tag code " dans description de site
Panneau d'Administration >> Général >> Configuration >> Et collez le code dans la description du site et enregistrez.
Et le "insert tag code " dans votre post.
Il faut que le HTML soit activé dans les messages et désactivez un éventuel bloqueur de pub du navigateur.
Cdt.
- le Jeu 7 Nov 2019 - 9:28
- Rechercher dans: Corbeille & Titres non explicites
- Sujet: Intégration d'une bannière publicitaire
- Réponses: 7
- Vues: 891
Chauve souris halloween
BonjourVous pouvez mettre ceci dans gestion des codes javascript
- Code:
(function($) {
$._spritely = {instances:{}, animate:function(options) {
var el = $(options.el);
var el_id = el.attr("id");
if (!$._spritely.instances[el_id]) {
return this;
}
options = $.extend(options, $._spritely.instances[el_id] || {});
if (options.type == "sprite" && options.fps) {
if (options.play_frames && !$._spritely.instances[el_id]["remaining_frames"]) {
$._spritely.instances[el_id]["remaining_frames"] = options.play_frames + 1;
} else {
if (options.do_once && !$._spritely.instances[el_id]["remaining_frames"]) {
$._spritely.instances[el_id]["remaining_frames"] = options.no_of_frames;
}
}
var frames;
var animate = function(el) {
var w = options.width, h = options.height;
if (!frames) {
frames = [];
total = 0;
for (var i = 0; i < options.no_of_frames; i++) {
frames[frames.length] = 0 - total;
total += w;
}
}
if ($._spritely.instances[el_id]["current_frame"] == 0) {
if (options.on_first_frame) {
options.on_first_frame(el);
}
} else {
if ($._spritely.instances[el_id]["current_frame"] == frames.length - 1) {
if (options.on_last_frame) {
options.on_last_frame(el);
}
}
}
if (options.on_frame && options.on_frame[$._spritely.instances[el_id]["current_frame"]]) {
options.on_frame[$._spritely.instances[el_id]["current_frame"]](el);
}
if (options.rewind == true) {
if ($._spritely.instances[el_id]["current_frame"] <= 0) {
$._spritely.instances[el_id]["current_frame"] = frames.length - 1;
} else {
$._spritely.instances[el_id]["current_frame"] = $._spritely.instances[el_id]["current_frame"] - 1;
}
} else {
if ($._spritely.instances[el_id]["current_frame"] >= frames.length - 1) {
$._spritely.instances[el_id]["current_frame"] = 0;
} else {
$._spritely.instances[el_id]["current_frame"] = $._spritely.instances[el_id]["current_frame"] + 1;
}
}
var yPos = $._spritely.getBgY(el);
el.css("background-position", frames[$._spritely.instances[el_id]["current_frame"]] + "px " + yPos);
if (options.bounce && options.bounce[0] > 0 && options.bounce[1] > 0) {
var ud = options.bounce[0];
var lr = options.bounce[1];
var ms = options.bounce[2];
el.animate({top:"+=" + ud + "px", left:"-=" + lr + "px"}, ms).animate({top:"-=" + ud + "px", left:"+=" + lr + "px"}, ms);
}
};
if ($._spritely.instances[el_id]["remaining_frames"] && $._spritely.instances[el_id]["remaining_frames"] > 0) {
$._spritely.instances[el_id]["remaining_frames"]--;
if ($._spritely.instances[el_id]["remaining_frames"] == 0) {
$._spritely.instances[el_id]["remaining_frames"] = -1;
delete $._spritely.instances[el_id]["remaining_frames"];
return this;
} else {
animate(el);
}
} else {
if ($._spritely.instances[el_id]["remaining_frames"] != -1) {
animate(el);
}
}
} else {
if (options.type == "pan") {
if (!$._spritely.instances[el_id]["_stopped"]) {
var speed = options.speed || 1, start_x = $._spritely.instances[el_id]["l"] || parseInt($._spritely.getBgX(el).replace("px", ""), 10) || 0, start_y = $._spritely.instances[el_id]["t"] || parseInt($._spritely.getBgY(el).replace("px", ""), 10) || 0;
if (options.do_once && !$._spritely.instances[el_id].remaining_frames || $._spritely.instances[el_id].remaining_frames <= 0) {
switch(options.dir) {
case "up":
case "down":
$._spritely.instances[el_id].remaining_frames = Math.floor((options.img_height || 0) / speed);
break;
case "left":
case "right":
$._spritely.instances[el_id].remaining_frames = Math.floor((options.img_width || 0) / speed);
break;
}
$._spritely.instances[el_id].remaining_frames++;
} else {
if (options.do_once) {
$._spritely.instances[el_id].remaining_frames--;
}
}
switch(options.dir) {
case "up":
speed *= -1;
case "down":
if (!$._spritely.instances[el_id]["l"]) {
$._spritely.instances[el_id]["l"] = start_x;
}
$._spritely.instances[el_id]["t"] = start_y + speed;
if (options.img_height) {
$._spritely.instances[el_id]["t"] %= options.img_height;
}
break;
case "left":
speed *= -1;
case "right":
if (!$._spritely.instances[el_id]["t"]) {
$._spritely.instances[el_id]["t"] = start_y;
}
$._spritely.instances[el_id]["l"] = start_x + speed;
if (options.img_width) {
$._spritely.instances[el_id]["l"] %= options.img_width;
}
break;
}
var bg_left = $._spritely.instances[el_id]["l"].toString();
if (bg_left.indexOf("%") == -1) {
bg_left += "px ";
} else {
bg_left += " ";
}
var bg_top = $._spritely.instances[el_id]["t"].toString();
if (bg_top.indexOf("%") == -1) {
bg_top += "px ";
} else {
bg_top += " ";
}
$(el).css("background-position", bg_left + bg_top);
if (options.do_once && !$._spritely.instances[el_id].remaining_frames) {
return this;
}
}
}
}
$._spritely.instances[el_id]["options"] = options;
$._spritely.instances[el_id]["timeout"] = window.setTimeout(function() {
$._spritely.animate(options);
}, parseInt(1000 / options.fps));
}, randomIntBetween:function(lower, higher) {
return parseInt(rand_no = Math.floor((higher - (lower - 1)) * Math.random()) + lower);
}, getBgUseXY:function() {
try {
return typeof $("body").css("background-position-x") == "string";
} catch (e) {
return false;
}
}(), getBgY:function(el) {
if ($._spritely.getBgUseXY) {
return $(el).css("background-position-y") || "0";
} else {
return ($(el).css("background-position") || " ").split(" ")[1];
}
}, getBgX:function(el) {
if ($._spritely.getBgUseXY) {
return $(el).css("background-position-x") || "0";
} else {
return ($(el).css("background-position") || " ").split(" ")[0];
}
}, get_rel_pos:function(pos, w) {
var r = pos;
if (pos < 0) {
while (r < 0) {
r += w;
}
} else {
while (r > w) {
r -= w;
}
}
return r;
}, _spStrip:function(s, chars) {
while (s.length) {
var i, sr, nos = false, noe = false;
for (i = 0; i < chars.length; i++) {
var ss = s.slice(0, 1);
sr = s.slice(1);
if (chars.indexOf(ss) > -1) {
s = sr;
} else {
nos = true;
}
}
for (i = 0; i < chars.length; i++) {
var se = s.slice(-1);
sr = s.slice(0, -1);
if (chars.indexOf(se) > -1) {
s = sr;
} else {
noe = true;
}
}
if (nos && noe) {
return s;
}
}
return "";
}};
$.fn.extend({spritely:function(options) {
var $this = $(this), el_id = $this.attr("id"), options = $.extend({type:"sprite", do_once:false, width:null, height:null, img_width:0, img_height:0, fps:12, no_of_frames:2, play_frames:0}, options || {}), background_image = new Image, background_image_src = $._spritely._spStrip($this.css("background-image") || "", 'url("); ');
if (!$._spritely.instances[el_id]) {
if (options.start_at_frame) {
$._spritely.instances[el_id] = {current_frame:options.start_at_frame - 1};
} else {
$._spritely.instances[el_id] = {current_frame:-1};
}
}
$._spritely.instances[el_id]["type"] = options.type;
$._spritely.instances[el_id]["depth"] = options.depth;
options.el = $this;
options.width = options.width || $this.width() || 100;
options.height = options.height || $this.height() || 100;
background_image.onload = function() {
options.img_width = background_image.width;
options.img_height = background_image.height;
options.img = background_image;
var get_rate = function() {
return parseInt(1000 / options.fps);
};
if (!options.do_once) {
setTimeout(function() {
$._spritely.animate(options);
}, get_rate(options.fps));
} else {
setTimeout(function() {
$._spritely.animate(options);
}, 0);
}
};
background_image.src = background_image_src;
return this;
}, sprite:function(options) {
var options = $.extend({type:"sprite", bounce:[0, 0, 1000]}, options || {});
return $(this).spritely(options);
}, pan:function(options) {
var options = $.extend({type:"pan", dir:"left", continuous:true, speed:1}, options || {});
return $(this).spritely(options);
}, flyToTap:function(options) {
var options = $.extend({el_to_move:null, type:"moveToTap", ms:1000, do_once:true}, options || {});
if (options.el_to_move) {
$(options.el_to_move).active();
}
if ($._spritely.activeSprite) {
if (window.Touch) {
$(this)[0].ontouchstart = function(e) {
var el_to_move = $._spritely.activeSprite;
var touch = e.touches[0];
var t = touch.pageY - el_to_move.height() / 2;
var l = touch.pageX - el_to_move.width() / 2;
el_to_move.animate({top:t + "px", left:l + "px"}, 1000);
};
} else {
$(this).click(function(e) {
var el_to_move = $._spritely.activeSprite;
$(el_to_move).stop(true);
var w = el_to_move.width();
var h = el_to_move.height();
var l = e.pageX - w / 2;
var t = e.pageY - h / 2;
el_to_move.animate({top:t + "px", left:l + "px"}, 1000);
});
}
}
return this;
}, isDraggable:function(options) {
if (!$(this).draggable) {
return this;
}
var options = $.extend({type:"isDraggable", start:null, stop:null, drag:null}, options || {});
var el_id = $(this).attr("id");
if (!$._spritely.instances[el_id]) {
return this;
}
$._spritely.instances[el_id].isDraggableOptions = options;
$(this).draggable({start:function() {
var el_id = $(this).attr("id");
$._spritely.instances[el_id].stop_random = true;
$(this).stop(true);
if ($._spritely.instances[el_id].isDraggableOptions.start) {
$._spritely.instances[el_id].isDraggableOptions.start(this);
}
}, drag:options.drag, stop:function() {
var el_id = $(this).attr("id");
$._spritely.instances[el_id].stop_random = false;
if ($._spritely.instances[el_id].isDraggableOptions.stop) {
$._spritely.instances[el_id].isDraggableOptions.stop(this);
}
}});
return this;
}, active:function() {
$._spritely.activeSprite = this;
return this;
}, activeOnClick:function() {
var el = $(this);
if (window.Touch) {
el[0].ontouchstart = function(e) {
$._spritely.activeSprite = el;
};
} else {
el.click(function(e) {
$._spritely.activeSprite = el;
});
}
return this;
}, spRandom:function(options) {
var options = $.extend({top:50, left:50, right:290, bottom:320, speed:4000, pause:0}, options || {});
var el_id = $(this).attr("id");
if (!$._spritely.instances[el_id]) {
return this;
}
if (!$._spritely.instances[el_id].stop_random) {
var r = $._spritely.randomIntBetween;
var t = r(options.top, options.bottom);
var l = r(options.left, options.right);
$("#" + el_id).animate({top:t + "px", left:l + "px"}, options.speed);
}
window.setTimeout(function() {
$("#" + el_id).spRandom(options);
}, options.speed + options.pause);
return this;
}, makeAbsolute:function() {
return this.each(function() {
var el = $(this);
var pos = el.position();
el.css({position:"absolute", marginLeft:0, marginTop:0, top:pos.top, left:pos.left}).remove().appendTo("body");
});
}, spSet:function(prop_name, prop_value) {
var el_id = $(this).attr("id");
$._spritely.instances[el_id][prop_name] = prop_value;
return this;
}, spGet:function(prop_name, prop_value) {
var el_id = $(this).attr("id");
return $._spritely.instances[el_id][prop_name];
}, spStop:function(bool) {
this.each(function() {
var $this = $(this), el_id = $this.attr("id");
if ($._spritely.instances[el_id]["options"]["fps"]) {
$._spritely.instances[el_id]["_last_fps"] = $._spritely.instances[el_id]["options"]["fps"];
}
if ($._spritely.instances[el_id]["type"] == "sprite") {
$this.spSet("fps", 0);
}
$._spritely.instances[el_id]["_stopped"] = true;
$._spritely.instances[el_id]["_stopped_f1"] = bool;
if (bool) {
var bp_top = $._spritely.getBgY($(this));
$this.css("background-position", "0 " + bp_top);
}
});
return this;
}, spStart:function() {
$(this).each(function() {
var el_id = $(this).attr("id");
var fps = $._spritely.instances[el_id]["_last_fps"] || 12;
if ($._spritely.instances[el_id]["type"] == "sprite") {
$(this).spSet("fps", fps);
}
$._spritely.instances[el_id]["_stopped"] = false;
});
return this;
}, spToggle:function() {
var el_id = $(this).attr("id");
var stopped = $._spritely.instances[el_id]["_stopped"] || false;
var stopped_f1 = $._spritely.instances[el_id]["_stopped_f1"] || false;
if (stopped) {
$(this).spStart();
} else {
$(this).spStop(stopped_f1);
}
return this;
}, fps:function(fps) {
$(this).each(function() {
$(this).spSet("fps", fps);
});
return this;
}, goToFrame:function(n) {
var el_id = $(this).attr("id");
if ($._spritely.instances && $._spritely.instances[el_id]) {
$._spritely.instances[el_id]["current_frame"] = n - 1;
}
return this;
}, spSpeed:function(speed) {
$(this).each(function() {
$(this).spSet("speed", speed);
});
return this;
}, spRelSpeed:function(speed) {
$(this).each(function() {
var rel_depth = $(this).spGet("depth") / 100;
$(this).spSet("speed", speed * rel_depth);
});
return this;
}, spChangeDir:function(dir) {
$(this).each(function() {
$(this).spSet("dir", dir);
});
return this;
}, spState:function(n) {
$(this).each(function() {
var yPos = (n - 1) * $(this).height() + "px";
var xPos = $._spritely.getBgX($(this));
var bp = xPos + " -" + yPos;
$(this).css("background-position", bp);
});
return this;
}, lockTo:function(el, options) {
$(this).each(function() {
var el_id = $(this).attr("id");
if (!$._spritely.instances[el_id]) {
return this;
}
$._spritely.instances[el_id]["locked_el"] = $(this);
$._spritely.instances[el_id]["lock_to"] = $(el);
$._spritely.instances[el_id]["lock_to_options"] = options;
$._spritely.instances[el_id]["interval"] = window.setInterval(function() {
if ($._spritely.instances[el_id]["lock_to"]) {
var locked_el = $._spritely.instances[el_id]["locked_el"];
var locked_to_el = $._spritely.instances[el_id]["lock_to"];
var locked_to_options = $._spritely.instances[el_id]["lock_to_options"];
var locked_to_el_w = locked_to_options.bg_img_width;
var locked_to_el_h = locked_to_el.height();
var locked_to_el_y = $._spritely.getBgY(locked_to_el);
var locked_to_el_x = $._spritely.getBgX(locked_to_el);
var el_l = parseInt(locked_to_el_x) + parseInt(locked_to_options["left"]);
var el_t = parseInt(locked_to_el_y) + parseInt(locked_to_options["top"]);
el_l = $._spritely.get_rel_pos(el_l, locked_to_el_w);
$(locked_el).css({"top":el_t + "px", "left":el_l + "px"});
}
}, options.interval || 20);
});
return this;
}, destroy:function() {
var el = $(this);
var el_id = $(this).attr("id");
if ($._spritely.instances[el_id] && $._spritely.instances[el_id]["timeout"]) {
window.clearTimeout($._spritely.instances[el_id]["timeout"]);
}
if ($._spritely.instances[el_id] && $._spritely.instances[el_id]["interval"]) {
window.clearInterval($._spritely.instances[el_id]["interval"]);
}
delete $._spritely.instances[el_id];
return this;
}});
})(jQuery);
try {
document.execCommand("BackgroundImageCache", false, true);
} catch (err) {
}
(function($) {
$(document).ready(function() {
$("body").after('<div id=\"stage\" class=\"stage\"><\/div><div id=\"space\"><\/div>');
$("#space").sprite({fps:3, no_of_frames:1}).animate({opacity:"0.9"}, 5000).spRandom({top:5, bottom:522, left:60, right:1080, speed:4000, pause:3000}).isDraggable().activeOnClick().active();
$("body").flyToTap();
});
})(jQuery);
Tout à la fin du code vous pouvez faire des modifications dans cette partie
- Code:
$("#space").sprite({fps:3, no_of_frames:1}).animate({opacity:"0.9"}, 5000).spRandom({top:5, bottom:522, left:60, right:1080, speed:4000, pause:3000}).
Vous pouvez changez l'opacité
- Code:
animate({opacity:"0.9"}
de 0.1 à 1
Ici le déplacement par rapport au haut de page
- Code:
spRandom({top:5, bottom:522
Ici le déplacement par rapport au bord gauche de la page
- Code:
left:60, right:1080,
Ici la vitesse
- Code:
speed:4000,
diminuer pour augmenter
Ici le temps de pause en ms
- Code:
pause:3000
Il faut ensuite mettre la partie CSS pour insérer l'image
- Code:
/*SPRITELY STAGE*/
#stage {
top: 0px;
left: 0px;
z-index: 999;
}
/*space SPRITE*/
#space {
background: transparent url(https://i.servimg.com/u/f38/19/97/91/04/ezgif-10.gif) 0 0 no-repeat;
position: absolute;
top: -60px;
left: -150px;
width: 154px;
height: 154px;
z-index: 999;
cursor: pointer;
}
mettre votre image en changeant ce lien
https://i.servimg.com/u/f38/19/97/91/04/ezgif-10.gif
pensez aussi à changer ces valeurs pour la taille de votre image
- Code:
width: 154px;
height: 154px;
Normalement cela devrait fonctionner
cdt.
- le Dim 3 Nov 2019 - 12:35
- Rechercher dans: Archives des problèmes avec un code
- Sujet: Chauve souris halloween
- Réponses: 24
- Vues: 980
Chauve souris halloween
BonsoirOn peut mettre une autre image à la place de la chauve souris bien que le script soit prévu pour une image " sprite sheet"
Comme les sprites dans les jeux vidéos .
la chauve souris par exemple
Mais vous pouvez mettre une image ou un gif en faisant quelques modifications
vous voulez mettre quel image ?
Cdt.
- le Ven 1 Nov 2019 - 22:10
- Rechercher dans: Archives des problèmes avec un code
- Sujet: Chauve souris halloween
- Réponses: 24
- Vues: 980
Problème de javascript Bannière Aléatoire
BonjourVous avez du CSS dans un de vos scripts ( un script pour chatbox apparemment )
celui ci
- Code:
$(window).load(function(){var chatbox_script=function(){$('#chatbox > p > .msg > span').filter('[style="color:green"],[style="color:red"]').closest('p').remove();var overrided=Chatbox.prototype.refresh;Chatbox.prototype.refresh=function(data){if(data.messages&&data.messages.length){data.messages=$.grep(data.messages,function(v){return v.userId!=-10||$.inArray(v.msgColor,["red","green"])==-1})}overrided.call(this,data)}};var s=document.createElement('script');s.text="("+chatbox_script.toString()+")();";$('object[data^="/chatbox/index.forum"],iframe[src^="/chatbox/index.forum"]').each(function(){try{$(this.contentDocument||this.contentWindow.document).find("#chatbox").closest("html").find("head").first().each(function(){this.appendChild(s.cloneNode(true))})}catch(a){}})});#chatbox_messenger_form[for="format-underline"],#chatbox_messenger_form[for="format-strike"],#chatbox_messenger_form[for=format-bold],#chatbox_messenger_form[for=format-italic]{display:none}#divcolor,#divsmilies{display:none!important}
vous avez ce css en fin de script qu'il faut supprimer ou mettre dans votre CSS
- Code:
#chatbox_messenger_form[for="format-underline"],#chatbox_messenger_form[for="format-strike"],#chatbox_messenger_form[for=format-bold],#chatbox_messenger_form[for=format-italic]{display:none}#divcolor,#divsmilies{display:none!important}
*Les scripts même s'ils sont séparés dans votre PA se retrouvent sur une même page si l'un d'eux à une erreur les autres risquent de ne pas fonctionner..
Par exemple pour toutes les pages ils se retrouvent sur cette unique page
http://welcometohogwarts.forumactif.com/99672.js
Cdt.
- le Sam 26 Oct 2019 - 8:53
- Rechercher dans: Archives des problèmes avec un code
- Sujet: Problème de javascript Bannière Aléatoire
- Réponses: 3
- Vues: 390
iframe dans la partie règlement des forums et catégories
demeter1 a écrit:
la partie règlement des forums et catégories n'autorisant que le bbcode,
Bonsoir demeter
Je ne sais même pas ou est cette partie (et c'est pas une boutade ;-) )
- le Jeu 24 Oct 2019 - 22:27
- Rechercher dans: Archives des problèmes avec un code
- Sujet: iframe dans la partie règlement des forums et catégories
- Réponses: 14
- Vues: 704
Header conditionnel
Bonsoir zz10je nage un peu en ce qui concerne synchrone et asynchrone
Peut être une piste par ici
https://trevweb.me.uk/javascripthtml-synchronous-and-asynchronous-loading/
https://trevweb.me.uk/javascript-include/
cdt.
- le Jeu 24 Oct 2019 - 22:24
- Rechercher dans: Archives des problèmes avec un code
- Sujet: Header conditionnel
- Réponses: 14
- Vues: 831