Last active
August 29, 2015 14:04
-
-
Save dstyle0210/5255dba4708e54d2ab88 to your computer and use it in GitHub Desktop.
이미지 온오프 함수
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
| //jQuery Extend image OnOff : dstyle | |
| //이미지 배열에서 특정 인덱스만 온으로 바꿈. | |
| (function($){ | |
| $.fn.onoff = function(opt){ | |
| var o={ | |
| idx:0, | |
| ext:"gif", | |
| sep:"On" | |
| }; | |
| (($.type(opt)=="object")?$.extend(o,opt):(o.idx = opt+"")); | |
| this.each(function(n,m){ | |
| m.src = (m.src).replace(o.sep+"."+o.ext,"."+o.ext); | |
| if(n==o.idx){ | |
| m.src = (m.src).replace("."+o.ext,o.sep+"."+o.ext); | |
| }; | |
| }); | |
| }; | |
| })(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment