orbit-announcement/app/assets/javascripts/announcement_link.js

46 lines
1.3 KiB
JavaScript
Raw Normal View History

2014-01-14 11:54:35 +00:00
$(document).ready(function(){
var topic1="0px";
var topic2="-948px";
var topic3="-1896px";
var topic_page=1;
$(".topic_prev").addClass("topic_prev_first");
$(document).on("click", ".topic_prev", function() {
if (topic_page !=1){
topic_page-=1;
}else{
}
if (topic_page == 1){
$("#topic_list").stop().animate({"left": topic1}, "slow");
$(".topic_prev").addClass("topic_prev_first");
}
if (topic_page == 2){
$("#topic_list").stop().animate({"left": topic2}, "slow");
$(".topic_prev").removeClass("topic_prev_first");
$(".topic_next").removeClass("topic_next_last");
}
if (topic_page == 3){
$("#topic_list").stop().animate({"left": topic3}, "slow");
$(".topic_prev").removeClass("topic_next_last");
}
});
$(document).on("click", ".topic_next", function() {
if (topic_page >=1 && topic_page <=2){
topic_page+=1;
}else{
}
if (topic_page == 1){
$("#topic_list").stop().animate({"left": topic1}, "slow");
$(".topic_prev").addClass("topic_prev_first");
}
if (topic_page == 2){
$("#topic_list").stop().animate({"left": topic2}, "slow");
$(".topic_prev").removeClass("topic_prev_first");
}
if (topic_page == 3){
$("#topic_list").stop().animate({"left": topic3}, "slow");
$(".topic_next").addClass("topic_next_last");
}
});
});