Próbáljuk a kódot átnézni
Hello,
A napokban vacakoltam egy menuvel es szuksegem lenne par tanacsra. Peldaul, hogy tudnam a kodot egyszerusiteni:Nem vagyok egy jQuery asz, es biztos sokat ismeteltem a kodban, gondolom lehetne egyrusiteni.
Egyebkent az oldal mukodesben itt lathato: http://progra.ro/menu2/
Barmilyen tanacsot ertekelek, koszonom! Esetleg mit lehetne modositani, kiszedni, berakni!
■ A napokban vacakoltam egy menuvel es szuksegem lenne par tanacsra. Peldaul, hogy tudnam a kodot egyszerusiteni:
- $(document).ready(function() {
- var links = $('.buttons a');
- /**** AKTIV LINKEK ****/
- links.each(function() {
- // Megnezuk ha leteznek aktiv linkek es megkapjuk mindegyik indexet
- var index = links.index(this);
- // Az aktiv linkeket szinezuk a tobbit pedig nem
- if ($(this).hasClass('active')) {
- $(this).css('backgroundPosition', '-' + index * 200 + 'px -50px');
- }
- else {
- $(this).css('backgroundPosition', '-' + index * 200 + 'px -0px');
- }
- });
- /**** AZ ANIMACIO ****/
- links.hover(function() {
- // Ha nincs aktiv linken az eger akkor johet az animacio!
- if (!$(this).hasClass('active')) {
- var index = links.index(this);
- $(this).stop().animate({backgroundPosition:"(-" + 200 * index + "px -50px)"}, {duration: 600})
- }
- }, function() {
- // Ha leveszuk az egeret a linkrol eltunik az animacio
- if (!$(this).hasClass('active')) {
- var index = links.index(this);
- $(this).stop().animate({backgroundPosition:"(-" + 200 * index + "px -0px)"}, {duration:800})
- }
- });
- });
Egyebkent az oldal mukodesben itt lathato: http://progra.ro/menu2/
Barmilyen tanacsot ertekelek, koszonom! Esetleg mit lehetne modositani, kiszedni, berakni!