티스토리 뷰
<div id="<?=$uid=uniqid()?>">
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRyjSgmd0Hx9rY7AsO7LFDsU0w9RFELuxrh6DBExerWVTMDzt2NUw">
</div>
<script>
$(function() {
var $uid = $('#<?=$uid?>');
$uid.css({
position:'fixed',
right:'50px',
bottom:'50px',
zIndex:'999999'
}).hide().find('>img').css({
cursor:'pointer'
}).click(function() {
scrollTo(0, 0);
});
$(window).scroll(function() {
var y = $(window).scrollTop();
if (y > 300 && $uid.is(':hidden'))
$uid.fadeIn('slow');
else if (y < 300 && $uid.is(':visible'))
$uid.fadeOut('slow');
});
});
</script>
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRyjSgmd0Hx9rY7AsO7LFDsU0w9RFELuxrh6DBExerWVTMDzt2NUw">
</div>
<script>
$(function() {
var $uid = $('#<?=$uid?>');
$uid.css({
position:'fixed',
right:'50px',
bottom:'50px',
zIndex:'999999'
}).hide().find('>img').css({
cursor:'pointer'
}).click(function() {
scrollTo(0, 0);
});
$(window).scroll(function() {
var y = $(window).scrollTop();
if (y > 300 && $uid.is(':hidden'))
$uid.fadeIn('slow');
else if (y < 300 && $uid.is(':visible'))
$uid.fadeOut('slow');
});
});
</script>
'노트 > JS' 카테고리의 다른 글
Get Selected Text (0) | 2016.09.09 |
---|---|
beep (0) | 2016.08.18 |
number_format (0) | 2016.08.18 |
refresh (0) | 2016.08.18 |
contenteditable (0) | 2016.08.18 |
댓글