tinyscrollbar extension

This commit is contained in:
Harry Bomrah 2012-07-09 17:29:35 +08:00
parent e48735a4ac
commit 1650d86440
2 changed files with 41 additions and 35 deletions

View File

@ -66,7 +66,6 @@
{ {
oSelf.update(); oSelf.update();
setEvents(); setEvents();
return oSelf; return oSelf;
} }

View File

@ -608,12 +608,18 @@ var orbitDesktop = function(dom){
$('.tinycanvas').each(function(){ $('.tinycanvas').each(function(){
var h = $(this).parent().height(), var h = $(this).parent().height(),
sh = $(this).siblings('.s_tab').height(); sh = $(this).siblings('.s_tab').height();
$(this) o.tinyscrollbar_ext({
.css({'height': h-sh-24}) main : $(this),
.tinyscrollbar({ axis: 'y'}) height : h-sh-24,
.find('.scrollbar') },{
.delay(1500) axis : "y"
.addClass('op00', 500); })
// $(this)
// .css({'height': h-sh-24})
// .tinyscrollbar({ axis: 'y'})
// .find('.scrollbar')
// .delay(1500)
// .addClass('op00', 500);
}); });
$("a#name_save_btn").click(function(){ $("a#name_save_btn").click(function(){
@ -1390,18 +1396,10 @@ var orbitDesktop = function(dom){
var list = function(){ var list = function(){
var bindHandlers = function(){ var bindHandlers = function(){
// fill width for tiny scroll bar o.tinyscrollbar_ext({
var e = $('.list_t'), main : ".tinycanvas",
count = e.length, fill : ".list_t"
baseWidth = e.eq(1).outerWidth(true); })
e.parents('.overview').width( baseWidth * count );
$('.tinycanvas')
.tinyscrollbar({ axis: 'x'})
.find('.scrollbar')
.delay(1500)
.addClass('op00', 500);
} }
$("div#seminar_p div#panel_r").load("/desktop/seminar_p_list",function(){ $("div#seminar_p div#panel_r").load("/desktop/seminar_p_list",function(){
@ -1483,34 +1481,43 @@ var orbitDesktop = function(dom){
o.notify("Wallpaper saving failed!!","imp",2); o.notify("Wallpaper saving failed!!","imp",2);
}) })
}; };
this.tinyscrollbar_ext = function(target,fill,tinysettings){ this.tinyscrollbar_ext = function(target,tinysettings){
tinysettings = ( typeof tinysettings == 'undefined' ) ? {} : tinysettings ; //main : dom on which tinyscrollbar has to be applied
tinysettings.theight = ( typeof tinysettings.theight == 'undefined' ) ? '' : tinysettings.theight ; //fill : number or object for width
//height : height for the target element
//tinysettings : tinyscrollbar settings
if(typeof target.main == "undefined"){
o.notify('tinyscrollbar: target undefined','imp',2);
return;
}else{
target.main = $(target.main);
}
//var target.fill = $
var tinysettings = ( typeof tinysettings == 'undefined' ) ? {"axis":"x"} : tinysettings ;
var count,baseWidth; var count,baseWidth,fillArray,pxs;
if( typeof fill == 'object' ){ if( typeof target.fill == 'object' ){
count = fill.length; fillArray = target.main.find(target.fill);
baseWidth = fill.eq(1).outerWidth(true); count = fillArray.length;
fill.parents('.overview').width( baseWidth * count ); baseWidth = fillArray.eq(1).outerWidth(true);
target.main.find('.overview').width( baseWidth * count);
} else if( typeof fill == 'number' ){ } else if( typeof fill == 'number' ){
fill.parents('.overview').width( fill ); target.main.find('.overview').width( target.fill );
} else if( typeof fill == 'undefined' ){ } else if( typeof fill == 'undefined' ){
fill = fill;
} else { } else {
o.notify('tinyscrollbar: setting width failed','imp',2); o.notify('tinyscrollbar: setting width failed','imp',2);
} }
if(target.height)
target.main.height(target.height);
target.main
if( typeof $(target) !== 'undefined' ){
$(target)
.tinyscrollbar( tinysettings ) .tinyscrollbar( tinysettings )
.find('.scrollbar') .find('.scrollbar')
.delay(1500) .delay(1500)
.addClass('op00', 500); .addClass('op00', 500);
} else {
o.notify('tinyscrollbar: target undefined','imp',2);
}
}; };
this.simple_drop_down = function(){ this.simple_drop_down = function(){
// simple dropdown menu // simple dropdown menu