Copyright © 2014 JoungKyun.Kim All rights reserved.
개요
페이지 좌측 상하단에 scroll top, scroll bottom link 이미지를 출력
저장소 http://svn.oops.org/wsvn/JavaScript.jquery.scrollTB/
Changelog
+ v1.0.2 --------------------------------------------------------------------- * 2014.05.26 - add engine option whether execute scrollTB (default is true) + v1.0.1 --------------------------------------------------------------------- * 2014.01.28 - fixed wrong action when resize window - change call method to $.scrollTB from $.fn.scrollTB - recaculation when window height is changed - add $.scroll.recheck () prototype * 2014.01.08 - fixed wrong image url under IE9 + v1.0.0 --------------------------------------------------------------------- * 2014.01.07 - 1.0.0 release
Download
사용법
body tag 가장 마지막에 jquery-scrollTB package를 삽입한다.
<html> <header> @Header contents@ </header> <body> @Body contents@ <script src="jquery-scrollTB/jquery.scrollTB.min.js"></script> </body> </html>
옵션
<script> var sTBoptions = { style_to_top: '', // style of to-top image style_to_bottom: '', // style of to-bottom image img_top: prefix + 'img/top.png', // to-top image path img_bottom: prefix + 'img/bottom.png', // to-bottom image path offset: 200, // fadeIn or fadeOut when scroll to specified // value from top or bottom fade_duratio: 100, // duration of fade[In/Out] at image scroll_duration: 100 // duration of scroll }; </script> <script src="jquery-scrollTB/jquery.scrollTB.min.js"></script>
위의 값들은 기본값들이다.
scroll top/bottom 이미지 경로는 jquery-scrollTB package가 getElementByTagName을
이용하여 자동으로 설정을 한다. 하지만 IE7과 같은 이전 브라우저에서는 getElementsByTagName이
정상적으로 동작을 하지 않거나, 지원하지 않는 경우가 있다.
그러므로, 오래된 브라우저를 지원해야 한다면, 명확하게 img_top, img_bottom 옵션으로
이미지 경로를 명확하게 지정해 주는 것이 좋다.
Ajax Call
<script> $( '#form' ).ajaxForm ({ resetFrom: false, dataType: 'html', success: function (data, status, xhr) { $( '.some-div' ).html (data); $.scrollTB.recheck (); }, error: function (xhr) { alert ('error'); } }); </script>
Ajax call을 이용할 경우, document.height가 동적으로 변경될 수 있다. 이 경우, hieght가 변경이 되는 call 이후에 $.scrollTB.recheck () 를 호출하여 재계산을 할 수 있다.
라이센스
Copyright (c) 2014 JoungKyun.Kim <http://oops.org> All rights reserved. THE "BSD" LICENCE ----------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of JoungKyun.Kim nor the url of oops.org nor the names of their contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. END