AliMD / 1Tuts

:+1: Web Design Technology Tutorials
http://ali.md/tuts
63 stars 41 forks source link

C6 W3 S9 HW #391

Closed AliMD closed 11 years ago

AliMD commented 11 years ago

Method 1 (html5)

(function(){
  "use strict";

  var
    train = document.querySelector('.train'),
    btns = document.querySelectorAll('.btns li');

  for(var i=0;i<btns.length;i++){
    btns.item(i).index = i;
    btns.item(i).onclick=function(){
      train.style.left = (-450*this.index) +'px';
    };
  }
})();

live : http://jsbin.com/jsss/3

Method 2 (sefan jahate ettela)

(function(){
  "use strict";

  var
    train = document.querySelector('.train'),
    btns = document.querySelectorAll('.btns li');

  for(var i=0;i<btns.length;i++){
    (function(j){
       btns.item(j).onclick = function(){
         //alert(j);
         train.style.left = (-450*j) +'px';
      }
    })(i);
  }
})();

live : http://jsbin.com/jsss/4

AliMD commented 11 years ago

yani

if( autoPlayIv == true ){
  return null; // exit function
}
dante1357 commented 11 years ago

@ehsansh bazam age nafahmidi man kamel beshkafamesh az laye haye zirin behet tozih bedam!!! :D

@paskamari toam age nafahmidi begu tozih bedim! :P :D

@AliMD mohandes mage baraye moghayese dota motaghayer nabayad 3ta mosavi bezarim? chera shoma dota gozashti?

hbehkamal commented 11 years ago

@AliMD in 2kmeye ghalat kardamesh kojast man bzanam :question:

khob @dante1357 o @paskamari har chi ide o kar bud anjam dadan ...dg vase man chizi nmimune khob!

:hand: masalan alan yeki b man bge bkham vaghti slide next mishe rotate ham bshe bayad chikar konam?

ehsansh commented 11 years ago

autoPlayIv = setInterval(nextSlide,2000);


chera setinterval ro tuie autoPlayIv rikhte? chera ie moteghaier dige nasakhte barash? chera baiad sharte if bashe khob vaghti mouse ruie btns nist setinterval(next slide...) baiad ejra beshe dige che lozumi b chek kardan ie shart dare?.....sar dar nemiaram ! tuie inja http://jsbin.com/imewis sharte if va meghdar false dadan b autoPlayIv ro hazf kardam vali kar mikone

AliMD commented 11 years ago

@dante1357 chera vali agar bekhay ba true moghayese koni vaghti migi if(a) yani if(a==true) baraye mesal agar a=10 bashe if(a==true) kar mikone vali if(a===true) kar nemikone chon a=10 hastesh na true ! va setInterval ham ye number bar migardoone na true if(a) daghightaresh yani if(a!=false) ya behtare begam if a meghdar dasht agar nafahmidi begoo kharfahmet konam :D ehsas mikonam class kharej az class ham jaryan dare !

AliMD commented 11 years ago

@ehsansh cheghadr soal dari ! khodesh ye class khosoosiye javab e in hame soal barat kharj dare ha :cake:

bebin delbandam :dancer: na bebakhshid :baby: na inam zaye bood aha bebin del bandam :cat:

farz kon oon if nist vaghti mouse mire roo slide ha mikhaym setinterval motevaghef beshe khob hala bayad clearinterval konim khob chi ro clear konim ?! pass mirizimesh too ye moteghayer grifti ?

hala farz on too ye browser gorz mouse ro sari roosh harekat bedi momkene 2 bar setInterval etefagh biyofte pass oon if ro mizarim ke age az ghabl autoplay active bood dige dobare set nashe ok ?

baghiye tozihat ro be baradar dante misparam :D

AliMD commented 11 years ago

khosham miyad bahs ha dare takhassosi mishe va dige az sathe savad @omidgharib balatare ke biyad tozih bede :D kojayi omid ?

hbehkamal commented 11 years ago

:scream: @AliMD aghaye mihan 2oost! chikar konam k moghe'ei k slide next mishe Rotate ham bshe?

omidgharib commented 11 years ago

@hoseinBL khub rotate ham bede behesh:) @AliMD inaha didin javabesho dadam :)))

ehsansh commented 11 years ago

@AliMD bale :) faghat inke tu browser gorz chera age if nabashe mese inja http://jsbin.com/imewis setinterval momkene "2" bar ejra beshe ro nafahmidam k montazere baradar dante mimunam :D

hbehkamal commented 11 years ago

:scream:

HELP MEEEEE!

in slider moshkelesh chie?????chera kar nmikone? :angry:

AliMD commented 11 years ago

azoon jayi ke javabe dante kamelan bi tabte be soal hosein mibashad, (ba arze poozesh az barardar dante) ye tozih mokhtasar midam, age moshkeli dasht baradar omid hastand eslah mikonan :D

bebin delbandam

age mouse bere roo ye box mouseover misge bad dobare yeho biyad biroon ya ye window dige yeho biyad zire mouse bazi browser haye ziba mesle golab be rootoon iE nemifahman ye mouse out shode khob hala chi mishe ? hich ettefaghi nemiyofte ! 2bar clear mishe amma agar axesh pish biyad 2 bar setinterval mishe ke albate alab ke khoob fekr mikonam axesh mamoolan ettefagh nemiyofte kollan hamatoon sare karin ! man baraye ehtiyat ya vasvas neveshta :D joda az shookhi ye bahsi dare ke mogheye dars dadan behesh eshare mikonam va baraye mesal ino neveshtam shoma mitooni azash rad beshi ya behtare begam azash bekeshi biroon

dante1357 commented 11 years ago

@paskamari BE GHOLE BABAI DAR KOLA GHERMEZI: its so complicated, sooooo complicated! :)) :D

@AliMD aaaaaaaa! che ghad zur zadam fek kardam rush! akharam eshtebah bud! :)) :D heyfe in hame energy! :))

@omidgharib asheghe in javab dadanatam! :D :+1:

hbehkamal commented 11 years ago

@dante1357 va @AliMD inayeii k goftin marbute b soale man bud aya?

dante1357 commented 11 years ago

@AliMD mage autoPlayIv = setInterval(nextSlide, 5000); baes nemishe ke autoPlayIv true beshe?! :D

@hoseinBL na male soale @ehsansh bud!

hbehkamal commented 11 years ago

@dante1357 be ghole BABAei : jooooooooooone madaret bbin mosheke in slideram chie?

dante1357 commented 11 years ago

@hoseinBL jan neveshti

for (var i=0; i < btns.length; i++){
      (function(i){
        btns.item(i).onclick = function(){
          next(i);
        };
      })();
    }

khob dadash function o ba chi ejra kone?! vorudi behesh nadadi ke! ye "i" bayad bezari dakhele paranteze bade function! injuri doroste:

for (var i=0; i < btns.length; i++){
      (function(i){
        btns.item(i).onclick = function(){
          next(i);
        };
      })(i);
    }
dante1357 commented 11 years ago

@hoseinBL begole babai: MAN POOLAM O MIKHAM! :)) :D

hbehkamal commented 11 years ago

OMG! tnx @dante1357

dante1357 commented 11 years ago

@hoseinBL ma inja baraye khedmat be mardom hastim!

setade entekhabati aghaye boooQ! :D

AliMD commented 11 years ago

Raye ma dante ! na dige, chera tru beshe ? ye adad mishe ke id oon intervale farz kon chnta interval dari hala migi clear... khob age true bashe kodoomo clear kone !

dante1357 commented 11 years ago

@AliMD ha gereftam! injuri ghati mishe! ogey! :+1: pas man javabe soal e ehsano pak mikonam dge! :D kheyli shute! koveyte asan! :D mamnun ke mano az jahlo nadani birun avordi! :D

ostad mishe az alan ***.js o bekhunam? safatam mikeshe ya hanuz zude?

AliMD commented 11 years ago

rasman shode chat !

are, aslan savade js nemikhad ! too class ham nemigam az tarafi nadooni sakht pashimoon mishi amma be baghiye nagoo, kh kh kh

postetam edir kardam ke konjkavi nakonan

dante1357 commented 11 years ago

@AliMD merc! :D :X

ye soal dge, jScrollPane ham hamun keteab khuneie ke bahash site haye scroll i ro dorost mikonan?! site hai ke mamulan tu awwwards hastan o migam ke ba scroll shekla jabeja mishan!

hbehkamal commented 11 years ago

kasi nmidune chejuri ye kari konim k vaghti next mishe rotate ham bshe?

hbehkamal commented 11 years ago

khob man nmidunam rotate chjuri neveshte mishe shoma masalan rotate 180deg ro minevisi?

dante1357 commented 11 years ago

@hoseinBL ye kalak rashti bezan behesh! ye class tarif kon, be class begu rotate she, ba js begu vaghti ke click shod class e rotate begire! :)) :D be siar sade besiar laziz! :D

AliMD commented 11 years ago

System chat alimd rah oftad ! ali.md/chat

paskamari commented 11 years ago

@hoseinBL

div{
-webkit-transform : rotate(180deg);
}
AliMD commented 11 years ago

idea: baraye rotate ye class active besaz vaghti ye slide entekhab mishe behesh class bede dar halate addi (na active) behesh rotate bede va to actibe rotate to 0 kon

ehsansh commented 11 years ago

mamnun fek konam fahmidam nokteie jaleb inke vaghti ba "use strict" code neveshtam inja http://jsbin.com/oguqaq/3/edit

moshakhase if hatman baiad bashe vagarna kar nemikone b nazar miad k chan ta setInterval ro ejra mikone chon mouseout hastesh

ehsansh commented 11 years ago

baraie tamrin ta ghable php ina ro neveshtam:

  1. auto play http://jsbin.com/ijujok/2/edit
  2. auto play and stop http://jsbin.com/oguqaq/4/edit
  3. back and next http://jsbin.com/isujix/3/edit
dante1357 commented 11 years ago

@ehsansh tu kare sevomit ke dokme nexto back et asan kar nemikonan!

ehsansh commented 11 years ago

@dante1357 alan ie link dige gozashtam vase sevomi ba jsbin moshekl daram nemidunam chera intore code js minvisam bad mibinam nistesh codam! vase save cod chio baiad zad ke vaghti editam bar midari code baghie bemune?

dante1357 commented 11 years ago

@ehsansh ctrl+s bezani save mikone dge!

hbehkamal commented 11 years ago

Mine by the help of @dante1357

paskamari commented 11 years ago

Test 04

paskamari commented 11 years ago

Test 05

dante1357 commented 11 years ago

@paskamari besiar ziba! eyval! :+1:

dante1357 commented 11 years ago

AGHA shirini kiloui chande?! :D

omidgharib commented 11 years ago

@dante1357 bastegi dare chi begiri az koja begiri:))

dante1357 commented 11 years ago

@omidgharib ye shirini daneshjui! :D kolan 9t pool tu jibam daram! :))

omidgharib commented 11 years ago

@dante1357 man jat basham on 9tomane sarfe omore elmi mikonam na shirini foghesh khasti 2nafari yek koloche begir :)

dante1357 commented 11 years ago

@omidgharib hey nemishe! nobate mane shirini bebaram! :D ye zamani kiloui 4,5t bud!!!!!! :)))))))

hbehkamal commented 11 years ago

man dg harfi nadaram :tongue: http://ali.md/chat

omidgharib commented 11 years ago

@dante1357 on zamnao be ghole mahmud mamaro lolo bord :))

dante1357 commented 11 years ago

@hoseinBL na bahse shirini az bahsaye paye darsemune! :D chat nis ke! :D

@omidgharib INSHALA BA ENAYATE KHODAVAND VA BA ENTEKHABE FARDE ASLAH AZ TARAFE RAHBAR VAZ KHUB MISHE! :)) :D

omidgharib commented 11 years ago

It will it will only supreme leader :)))))

dante1357 commented 11 years ago

JUST GENERAL ALAEDIN! :)) :D :P

omidgharib commented 11 years ago

LOL :)))))