var strWrapStyle = strWrap.attr(‘style’);
if(strWrapStyle){
var wrapStyleArr = strWrapStyle.split(‘;’);
var startHeight = false;
for(var i=0; i < wrapStyleArr.length; i ){
var str = $.trim(wrapStyleArr[i]);
var tested = str.search(/^height/g);
if(tested != -1){
startHeight = parseFloat(strWrap.css(‘height’));
}
}
}
var code = function () {
strWrap.off(‘mouseleave’);
strWrap.off(‘mouseenter’);
strWrap.off(‘mousemove’);
strWrap.off(‘mousedown’);
strWrap.off(‘mouseup’);
if(!$(‘.str_move’,strWrap).length){
strWrap.wrapInner($(‘
’).addClass(‘str_move’));}
var
strMove = $(‘.str_move’, strWrap).addClass(‘str_origin’),
strMoveClone = strMove.clone().removeClass(‘str_origin’).addClass(‘str_move_clone’),
time = 0;
if (!p.hoverstop) {
strWrap.addClass(‘noStop’);
}
var circCloneHor = function(){
strMoveClone.clone().css({
left:‘100%’,
right:‘auto’,
width: strMove.width()
}).appendTo(strMove);
strMoveClone.css({
right: ‘100%’,
left:‘auto’,
width: strMove.width()
}).appendTo(strMove);
}
var circCloneVert = function(){
strMoveClone.clone().css({
top: ‘100%’,
bottom:‘auto’,
height: strMove.height()
}).appendTo(strMove);
strMoveClone.css({
bottom: ‘100%’,
top:‘auto’,
height:strMove.height()
}).appendTo(strMove);
}
if (p.direction == ‘left’) {
strWrap.height(strMove.outerHeight())
if (strMove.width() > strWrap.width()) {
var leftPos = -strMove.width();
if (p.circular) {
if (!p.xml) {
circCloneHor()
leftPos = -(strMove.width() (strMove.width() - strWrap.width()));
}
}
if (p.xml) {
strMove.css({
left:strWrap.width()
})
}
var
strMoveLeft = strWrap.width(),
k1 = 0,
timeFunc1 = function () {
var
fullS = Math.abs(leftPos),
time = (fullS / strWrap.data(‘scrollamount’)) * 1000;
if (parseFloat(strMove.css(‘left’)) != 0) {
fullS = (fullS strWrap.width());
time = (fullS - (strWrap.width() - parseFloat(strMove.css(‘left’)))) / strWrap.data(‘scrollamount’) * 1000;
}
return time;
},
moveFuncId1 = false,
moveFunc1 = function () {
if (loop != 0) {
strMove.stop(true).animate({
left: leftPos
}, timeFunc1(), ‘linear’, function () {
$(this).css({
left: strWrap.width()
});
if (loop == -1) {
moveFuncId1 = setTimeout(moveFunc1, p.scrolldelay);
} else {
loop–;
moveFuncId1 = setTimeout(moveFunc1, p.scrolldelay);
}
});
}
};
strWrap.data({
moveId: moveFuncId1 ,
moveF : moveFunc1
})
if(!p.inverthover){
moveFunc1();
}
if (p.hoverstop) {
strWrap.on(enterEvent, function () {
$(this).addClass(‘str_active’);
clearTimeout(moveFuncId1);
strMove.stop(true);
}).on(leaveEvent, function () {
$(this).removeClass(‘str_active’);
$(this).off(‘mousemove’);
moveFunc1();
});
if (p.drag) {
strWrap.on(‘mousedown’, function (e) {
if(p.inverthover){
strMove.stop(true);
}
//drag
var dragLeft;
var dir = 1;
var newX;
var oldX = e.clientX;
//drag
strMoveLeft = strMove.position().left;
k1 = strMoveLeft - (e.clientX - strWrap.offset().left);
$(this).on(‘mousemove’, function (e) {
fMove = true;
//drag
newX = e.clientX;
if(newX > oldX){
dir = 1
}else{
dir = -1
}
oldX = newX
dragLeft = k1 (e.clientX - strWrap.offset().left);
if (!p.circular) {
if(dragLeft < -strMove.width() && dir < 0){
dragLeft = strWrap.width();
strMoveLeft = strMove.position().left;
k1 = strMoveLeft - (e.clientX - strWrap.offset().left);
}
if(dragLeft