-4
Mootools를 Jquery로 변환하려고 할 때 특정 문제가 있습니다.이 MooTools 코드를 jQuery로 변환하는 방법
var Site = new Class({
Implements : Options,
options : {
},
initialize : function(options) {
// Set opzioni
this.setOptions(options);
var section = $$("body")[0].getProperty("class");
// Chiama metodo
if(typeof(this[section]) == "function") this[section]();
},
// Orerazioni di sezione
home: function(){
// Init scrollTo
new SmoothScroll({ duration: 800, transition:Fx.Transitions.Sine.easeOut, offset:{"x":0, "y":-40} });
// Definisce elementi draggabili
$("handle").addEvent("click", function(e){ e.stop(); })
new Drag.Move($('window'), {'handle':'handle'});
$("logo").fade("hide");
var ttop = $("simple-modal-title").getCoordinates().top + 100;
window.addEvent("scroll", function(){
if(window.getScroll().y >= ttop){
if(!$("simple-modal-title").hasClass("fixed")){ $("logo").fade("in"); }
$("simple-modal-title").addClass("fixed")
}else{
if($("simple-modal-title").hasClass("fixed")){ $("logo").fade("out"); }
$("simple-modal-title").removeClass("fixed");
}
}.bind(this));
this.checkLogo();
// Inizializza esempi
this.initExamples();
},
checkLogo: function(){
window.fireEvent("scroll")
},
// Smart Template
templating: function(s,d){
for (var p in d)
s = s.replace(new RegExp('{'+p+'}','g'), d[p]);
return s;
}
});
window.addEvent("domready", function(){
var site = new Site();
});
성공적으로 변환 할 수 있는지 잘 모르겠습니다. 당신의 도움을 주셔서 감사합니다! 나는 문자 그대로의 의미에서 질문으로이 취급하는 경우 :
... MooTools *는 실제로 jQuery보다 작습니다 ... 25kB 대 31kB입니다. 게다가, 거기에있는 것들을 위해, 아마도 MooTools More보다 훨씬 큰 jQuery UI와 같은 것이 필요할 것이다. –
@Reanimation, 위의 코드를 살펴보면 jQuery UI가 필요하지 않은 것으로 보입니다. 아주 똑바로 보인다. – Sparky
_ "특정 문제가 있습니다"_ - 실제로 문제가 있습니까? – nnnnnn