you could control the script by using button in line calls
modify the script(shown in red)
Code:
elements: function( where ) {
drag.id.css( { overflow: "hidden", position: "relative" } );
drag.id.wrapInner( '<div id="' + drag.t + '-content" class="' + drag.t + '-content"></div>' );
drag.c = $( '.' + drag.t + '-content' );
drag.id.append( '<div class="' + drag.t + '-bar"></div>' );
drag.b = $( '.' + drag.t + '-bar' );
drag.b.append( '<div id="' + drag.t + '-drag" class="' + drag.t + '-drag"></div>' );
drag.s = $( '.' + drag.t + '-drag' );
},
additional script
Code:
function zxcScroll(m,id,ud){
var c=document.getElementById(id+'-content'),s=document.getElementById(id+'-drag'),o=zxcScroll[id];
if (c&&s&&!o){
o=o=zxcScroll[id]={
sp:s.parentNode,
cp:c.parentNode
}
}
if (o){
var m=typeof(m)=='string'&&m.charAt(0).toUpperCase()=='V'?['left','offsetLeft','width','offsetWidth']:['top','offsetTop','height','offsetHeight'],x=o.cp[m[3]]-c[m[3]],n=Math.min(Math.max(c[m[1]]+ud,x),0);
c.style[m[0]]=n+'px';
s.style[m[0]]=(parseInt(o.sp.style[m[2]])-parseInt(s.style[m[2]]))*n/x+'px';
}
}
and for the DD examples
Code:
$( document ).ready( function() {
$( "div[rel='scrollcontent1']" ).customscroll( { direction: "vertical" } );
$( "div[rel='scrollcontent2']" ).customscroll( { direction: "horizontal", bounce:0 } );
});
the buttons for horizontal
Code:
<input type="button" name="" value="Scroll Up" onclick="zxcScroll('H','scrollcontent1',20);" />
<input type="button" name="" value="Scroll Down" onclick="zxcScroll('H','scrollcontent1',-20);" />
the buttons for vertical
Code:
<input type="button" name="" value="Scroll Right" onclick="zxcScroll('V','scrollcontent2',20);" />
<input type="button" name="" value="Scroll Left" onclick="zxcScroll('V','scrollcontent2',-20);" />
Bookmarks