2009-04-08 5 views
0

좋아요, 그래서 Joomla를 실행하는 사이트가 있고 mootools 1.11 프레임 워크를 사용하고 있습니다. mootools 1.2 프레임 워크의 예제를 사용하여 작업 버전을 만들어 냈지만 Joomla 사이트의 다른 모듈을 손상시키지 않으면 서 호환성 레이어와도 공존 할 수는 없습니다.Onload가 50 %로 divs opacity를 설정했습니다.

질문 나는 ".box_panel"의 클래스를 가진 div의 몇을 가지고 그들이 위로 마우스가 50 % 불투명도에서 이동하는 MouseLeave 다시 100 % 불투명도 그래서 나는 그것을있다. 내가 가지고있는 문제는 50 % onload로 설정하는 코드는 무엇입니까? Mootools의 1.2에서

내가 사용 :

<body onload="$$('div.box_panel').fade(0.5);"> 

내가 마우스를 두었을 위해 사용하고 코드 /하는 MouseLeave 효과는 다음과 같습니다

window.addEvent('domready',function() { 
    //first, apply a class to each of your menu element 
    //$$('.links') puts every element wearing the .links class into an array 
    //$$('.links').each is to browse the array an apply a function to... each of them 
    $$('.box_panel').each(function(el, i) { 
     //there comes exactly your former fx statement except for 
     var ExampleFx = new Fx.Style(el, 'opacity', { //the fact i apply the effect on el 
      wait: false, //and wait: false which make the effect not waiting (very useful on the mouseout or mouseleave function... 
      opacity: 0.5, 
      duration: 500, 
      transition: Fx.Transitions.Quart.easeInOut 
     }); 
     //and there i apply (always on el) the effect on mouseenter (similar in this case but often better than mouseover) 
     //and mouseleave (same for mouseenter but concerning mouesout) 
     el.addEvent('mouseleave', function() { ExampleFx.start(1, 0.5); }); 
     el.addEvent('mouseenter', function() { ExampleFx.start(0.5, 1); }); 

    }); 
}); 

답변

2

당신이 아니라 후 (마지막 괄호 전에 ExampleFx.start(1, 0.5);를 추가 할 수 $$('.box_panel')... 성명)?

+0

감사합니다. . 그것에 대해 생각 난 그냥 사용할 수, 이 $$ ('. box_panel') 각 (함수 (엘, 나는) { ExampleFx.start (1, 0.5) : –

+0

내가 성공하지 않고 다음과 같은 문 다음에 시도 .box_panel의 시작 불투명도를 설정하는 CSS 속성. –

0

간단한 :

 
$$('.box_panel').effect('opacity', 0.5); 
// run this right after your window.addEvent('domready', function() { 

편집 : 여기 조금 잘못이었다. Mladen Mihajlovic이 completly correct라고 답했다. 또한, 여기 당신을 위해 몇 가지 링크입니다 : 나는 그것을 시도 줄거야 이것에 대한