1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-03 06:55:03 +03:00

fix toolbar

This commit is contained in:
Mzhelskiy Maxim 2012-04-13 04:20:59 +04:00
parent 09388ae571
commit f773fde758
3 changed files with 32 additions and 12 deletions

View file

@ -27,6 +27,10 @@ ls.toolbar.topic = (function ($) {
}
};
this.reset = function() {
this.iCurrentTopic=-1;
};
/**
* Прокрутка следующему топику
*/
@ -69,4 +73,28 @@ ls.toolbar.topic = (function ($) {
};
return this;
}).call(ls.toolbar.topic || {},jQuery);
}).call(ls.toolbar.topic || {},jQuery);
/**
* Функционал кнопки "UP"
*/
ls.toolbar.up = (function ($) {
this.init = function() {
$(window).scroll(function(){
if ($(window).scrollTop() > $(window).height() / 2) {
$('#toolbar_scrollup').fadeIn(500);
} else {
$('#toolbar_scrollup').fadeOut(500);
}
});
};
this.goUp = function() {
ls.toolbar.topic.reset();
$.scrollTo(0, 500);
return false;
};
return this;
}).call(ls.toolbar.up || {},jQuery);

View file

@ -48,6 +48,8 @@ jQuery(document).ready(function($){
// Тул-бар топиков
ls.toolbar.topic.init();
// Кнопка "UP"
ls.toolbar.up.init();
// Всплывающие сообщения
@ -84,16 +86,6 @@ jQuery(document).ready(function($){
liveEvents: true,
showTimeout: 500
});
// Кнопка прокрутки вверх
$(window).scroll(function(){
if ($(window).scrollTop() > $(window).height() / 2) {
$('#toolbar_scrollup').fadeIn(500);
} else {
$('#toolbar_scrollup').fadeOut(500);
}
});
// Хук конца инициализации javascript-составляющих шаблона

View file

@ -1,3 +1,3 @@
<section class="toolbar-scrollup" id="toolbar_scrollup">
<a href="#" onclick="jQuery.scrollTo(0, 500); return false;" title="Вверх" class="toolbar-topic-prev"><i class="icon-chevron-up"></i></a>
<a href="#" onclick="return ls.toolbar.up.goUp();" title="Вверх" class="toolbar-topic-prev"><i class="icon-chevron-up"></i></a>
</section>