Created
June 11, 2016 05:52
-
-
Save Restoration/ffda9bac9788dc89c4b1e15d5fc604d0 to your computer and use it in GitHub Desktop.
setTimeoutで引数を渡す
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <title>Document</title> | |
| </head> | |
| <body> | |
| <script> | |
| jQuery(function($){ | |
| $('.trigger').onclick(function(){ | |
| function alertFnc($(this)){ | |
| alert($(this)); | |
| } | |
| setTimeout(alertFnc(),300); | |
| var target = $(this); | |
| setTimeout(function(){ | |
| //ここに処理を記述 | |
| //$(this)をsetTimeout関数に渡す時は第三引数に渡す | |
| },300,target); | |
| }); | |
| }); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment