2 // Gestion du Yellow Fade (fonctionnalite optionnelle)
3 function easeInOut(minValue
,maxValue
,totalSteps
,actualStep
,powr
) {
4 var delta
= maxValue
- minValue
;
5 var stepp
= minValue
+(Math
.pow(((1 / totalSteps
)*actualStep
),powr
)*delta
);
6 return Math
.ceil(stepp
)
9 function doBGFade(elem
,startRGB
,endRGB
,finalColor
,steps
,intervals
,powr
) {
10 if (elem
.bgFadeInt
) window
.clearInterval(elem
.bgFadeInt
);
12 elem
.bgFadeInt
= window
.setInterval(
14 elem
.style
.backgroundColor
= "rgb("+
15 easeInOut(startRGB
[0],endRGB
[0],steps
,actStep
,powr
)+","+
16 easeInOut(startRGB
[1],endRGB
[1],steps
,actStep
,powr
)+","+
17 easeInOut(startRGB
[2],endRGB
[2],steps
,actStep
,powr
)+")";
19 if (actStep
> steps
) {
20 elem
.style
.backgroundColor
= finalColor
;
21 window
.clearInterval(elem
.bgFadeInt
);
27 function findPos(obj
) {
28 var curleft
= curtop
= 0;
29 if (obj
.offsetParent
) {
30 curleft
= obj
.offsetLeft
;
31 curtop
= obj
.offsetTop
;
32 while (obj
= obj
.offsetParent
) {
33 curleft
+= obj
.offsetLeft
;
34 curtop
+= obj
.offsetTop
;
37 return [curleft
,curtop
];
40 // demarrage crayons-fade
41 jQuery(document
).ready(function() {
42 if (configCrayons
.cfg
.yellow_fade
) {
43 // Activer le Yellow Fade pour les elements editables
44 jQuery("div.crayon").hover(function(){doBGFade(this,[255,255,180],[255,255,255],'transparent',40,20,4);}, function(){});
47 if (configCrayons
.cfg
.filet
) {
48 // on rajoute une div supplémentaire qui se cale avec la div courante
49 // C'est elle qui va s'afficher lors du hover
52 jQuery('.crayon-icones img',this).css({
54 'border':'2px solid #999',
56 'background-color':'#FFF'
61 jQuery('.crayon-autorise').each(
63 var contenu
= jQuery(this).html();
65 .css('height',this.offsetHeight
+ 'px')
70 .css('position','absolute')
71 .css('width',this.offsetWidth
+ 'px');
73 .prepend('<div class="survol"></div>')
75 .css('border','1px solid red')
76 .css('display','none')
77 .css('position','absolute')
78 .css('height',(this.offsetHeight
- 2) + 'px')
79 .css('width',(this.offsetWidth
- 2) + 'px');
80 if (jQuery
.browser
.msie
) {
82 .css('width',this.offsetWidth
+ 'px')
83 .css('height',this.offsetHeight
+ 'px');
88 jQuery('.crayon-autorise').hover(
90 if (jQuery
.browser
.msie
) jQuery(this).addClass('crayon-hover');
91 jQuery('.survol', this).css('display','block');
94 if (jQuery
.browser
.msie
) jQuery(this).removeClass('crayon-hover');
95 jQuery('.survol', this).css('display','none');