orbit-basic/app/assets/javascripts/orbit-1.0.js

123 lines
4.1 KiB
JavaScript
Raw Normal View History

2012-02-29 08:01:50 +00:00
var viewportwidth,
viewportheight;
2012-04-29 16:17:18 +00:00
console.log($(window).height())
2012-02-29 08:01:50 +00:00
function resize() {
viewportheight=$(window).height();
viewportwidth=$(window).width();
if(window.navigator.userAgent.indexOf("MSIE")>0){
windH=document.clientHeight;
windW=document.clientWidht;
}
}
$(document).ready(function(){
$('.tip').tooltip({
placement: "left"
});
$(document).on('click', '.privacy', function() {
2012-04-01 18:46:34 +00:00
console.log($(this).val());
2012-02-29 08:01:50 +00:00
switch ($(this).val()) {
case 'true':
$(this).parents('.controls').children('.select-role').slideUp(300);
break;
case 'false':
$(this).parents('.controls').children('.select-role').slideDown(300);
break;
}
});
var $role = $('.select-role');
var method =$('.privacy:eq(1)').attr('checked');
if(method == 'checked'){
$role.slideDown(0);
}
$('.privacy').each(function($i) {
$(this).click(function() {
switch ($i) {
case 0:
$role.slideUp(300);
break;
case 1:
$role.slideDown(300);
break;
}
});
});
2012-02-29 08:01:50 +00:00
/*tinyscrollbar&windows-Size*/
resize();
var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2,
$subWiget = $('#sub-wiget').width()+18;
2012-04-29 16:17:18 +00:00
$orbitBar = $('#orbit-bar').height(),
$mainSidebar = $('#main-sidebar').width()+5,
$formActionPadding = parseInt($('.form-fixed').css("padding-left"))+parseInt($('.form-fixed').css("padding-right"));
console.log($orbitBar);
console.log("ready"+$(window).height());
$('#main-sidebar').css("height", viewportheight-$orbitBar);
$('#main-sidebar .viewport').css("height", viewportheight-$orbitBar);
$('#post-body').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget);
$('.post-title').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget-16);
2012-04-12 10:41:14 +00:00
$('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft);
2012-04-29 16:17:18 +00:00
$('.form-fixed').css("width", viewportwidth-$mainWrapMarginLeft-$formActionPadding);
$('#bulletin_pagination').css("width", viewportwidth-$mainSidebar);
$('#main-sidebar').tinyscrollbar({size:(viewportheight-$orbitBar-4)});
2012-02-29 08:01:50 +00:00
$('.detal-list').tinyscrollbar();
2012-04-01 18:46:34 +00:00
mainTablePosition();
2012-02-29 08:01:50 +00:00
/*isotope*/
var $container = $('#isotope');
$container.isotope({
itemSelector : '.item',
layoutMode : 'masonry',
});
});
$(window).resize(function(){
resize();
var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2,
$subWiget = $('#sub-wiget').width()+18;
2012-04-29 16:17:18 +00:00
$orbitBar = $('#orbit-bar').height(),
$mainSidebar = $('#main-sidebar').width()+5,
$formActionPadding = parseInt($('.form-fixed').css("padding-left"))+parseInt($('.form-fixed').css("padding-right"));
console.log(viewportheight);
$('#main-sidebar').css("height", viewportheight-$orbitBar);
$('#main-sidebar .viewport').css("height", viewportheight-$orbitBar);
$('#post-body').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget);
$('.post-title').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget-16);
2012-04-29 16:17:18 +00:00
$('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft);
$('.form-fixed').css("width", viewportwidth-$mainWrapMarginLeft-$formActionPadding);
$('#bulletin_pagination').css("width", viewportwidth-$mainSidebar);
$('#main-sidebar').tinyscrollbar({size:(viewportheight-$orbitBar-4)});
2012-04-01 18:46:34 +00:00
mainTablePosition();
2012-02-29 08:01:50 +00:00
});
/*main-table position*/
function mainTablePosition() {
2012-04-01 18:46:34 +00:00
var $height = $('#main-wrap .subnav').length && $('#main-wrap .subnav').height();
2012-04-12 10:41:14 +00:00
var $table = $('.main-list').length && $('.main-list:last');
if($table && $table==0){
$table.css({marginTop:$height});
}
else if($table){
2012-04-01 18:46:34 +00:00
if($height>0){
$height = $height-17;
}
$table.stop().animate({marginTop:$height},500);
2012-03-28 03:17:59 +00:00
}
else if($('#main-wrap .subnav')){
var $object = $('#main-wrap .subnav').next();
$object.css({marginTop:$height});
2012-04-01 18:46:34 +00:00
};
};
2012-02-29 08:01:50 +00:00
$(window).scroll(function () {
//var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-1;
//var $subnavWidth = parseInt($('#main-wrap > .subnav').css("width"));
var $winLeft = $(window).scrollLeft()
$(".table-label").css({left:$winLeft*-1} );
//$(".table-label").css({left:$mainWrapMarginLeft+($winLeft*-1)} );
//$("#main-wrap > .subnav").css({width:$subnavWidth+($winLeft)} );
//console.log($mainWrapMarginLeft+($winLeft*-1)+5);
});