(function ($) {
var methods = {
init: function (options) {
var p = {
direction: 'left',
loop: -1,
scrolldelay: 0,
scrollamount: 50,
circular: true,
drag: true,
runshort: true,
hoverstop: true,
inverthover: false,
xml: false
};
if (options) {
$.extend(p, options);
}
return this.each(function () {
var enterevent = 'mouseenter';
var leaveevent = 'mouseleave';
if(p.inverthover){
enterevent = 'mouseleave';
leaveevent = 'mouseenter';
}
var
loop = p.loop,
strwrap = $(this).addclass('str_wrap').data({scrollamount:p.scrollamount}),
fmove = false;
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 > strwrap.width() && dir > 0){
dragleft = -strmove.width();
strmoveleft = strmove.position().left;
k1 = strmoveleft - (e.clientx - strwrap.offset().left);
}
}else{
if(dragleft < -strmove.width() && dir < 0){
dragleft = 0;
strmoveleft = strmove.position().left;
k1 = strmoveleft - (e.clientx - strwrap.offset().left);
}
if(dragleft > 0 && dir > 0){
dragleft = -strmove.width();
strmoveleft = strmove.position().left;
k1 = strmoveleft - (e.clientx - strwrap.offset().left);
}
}
strmove.stop(true).css({
left: dragleft
});
//drag
}).on('mouseup', function () {
$(this).off('mousemove');
if(p.inverthover){
strmove.trigger('mouseenter')
}
settimeout(function () {
fmove = false
}, 50)
});
return false;
})
.on('click', function () {
if (fmove) {
return false
}
});
} else {
strwrap.addclass('no_drag');
};
}
} else {
if (p.runshort) {
strmove.css({
left: strwrap.width()
});
var
strmoveleft = strwrap.width(),
k1 = 0,
timefunc = function () {
time = (strmove.width() + strmove.position().left) / strwrap.data('scrollamount') * 1000;
return time;
};
var movefunc = function () {
var leftpos = -strmove.width();
strmove.animate({
left: leftpos
}, timefunc(), 'linear', function () {
$(this).css({
left: strwrap.width()
});
if (loop == -1) {
settimeout(movefunc, p.scrolldelay);
} else {
loop--;
settimeout(movefunc, p.scrolldelay);
}
});
};
strwrap.data({
movef : movefunc
})
if(!p.inverthover){
movefunc();
}
if (p.hoverstop) {
strwrap.on(enterevent, function () {
$(this).addclass('str_active');
strmove.stop(true);
}).on(leaveevent, function () {
$(this).removeclass('str_active');
$(this).off('mousemove');
movefunc();
});
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(dragleft < -strmove.width() && dir < 0){
dragleft = strwrap.width();
strmoveleft = strmove.position().left;
k1 = strmoveleft - (e.clientx - strwrap.offset().left);
}
if(dragleft > strwrap.width() && dir > 0){
dragleft = -strmove.width();
strmoveleft = strmove.position().left;
k1 = strmoveleft - (e.clientx - strwrap.offset().left);
}
strmove.stop(true).css({
left: dragleft
});
}).on('mouseup', function () {
if(p.inverthover){
strmove.trigger('mouseenter')
}
$(this).off('mousemove');
settimeout(function () {
fmove = false
}, 50)
});
return false;
})
.on('click', function () {
if (fmove) {
return false
}
});
} else {
strwrap.addclass('no_drag');
};
}
} else {
strwrap.addclass('str_static');
}
};
};
if (p.direction == 'right') {
strwrap.height(strmove.outerheight())
strwrap.addclass('str_right');
strmove.css({
left: -strmove.width(),
right: 'auto'
})
if (strmove.width() > strwrap.width()) {
var leftpos = strwrap.width();
strmove.css({
left: 0
})
if (p.circular) {
if (!p.xml) {
circclonehor()
//определяем крайнюю точку
leftpos = strmove.width();
}
}
var
k2 = 0;
timefunc = function () {
var
fulls = strwrap.width(), //крайняя точка
time = (fulls / strwrap.data('scrollamount')) * 1000; //время
if (parsefloat(strmove.css('left')) != 0) {
fulls = (strmove.width() + strwrap.width());
time = (fulls - (strmove.width() + parsefloat(strmove.css('left')))) / strwrap.data('scrollamount') * 1000;
}
return time;
};
var movefunc = function () {
if (loop != 0) {
strmove.animate({
left: leftpos
}, timefunc(), 'linear', function () {
$(this).css({
left: -strmove.width()
});
if (loop == -1) {
settimeout(movefunc, p.scrolldelay);
} else {
loop--;
settimeout(movefunc, p.scrolldelay);
};
});
};
};
strwrap.data({
movef : movefunc
})
if(!p.inverthover){
movefunc();
}
if (p.hoverstop) {
strwrap.on(enterevent, function () {
$(this).addclass('str_active');
strmove.stop(true);
}).on(leaveevent, function () {
$(this).removeclass('str_active');
$(this).off('mousemove');
movefunc();
});
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;
k2 = 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 = k2 + (e.clientx - strwrap.offset().left);
if (!p.circular) {
if(dragleft < -strmove.width() && dir < 0){
dragleft = strwrap.width();
strmoveleft = strmove.position().left;
k2 = strmoveleft - (e.clientx - strwrap.offset().left);
}
if(dragleft > strwrap.width() && dir > 0){
dragleft = -strmove.width();
strmoveleft = strmove.position().left;
k2 = strmoveleft - (e.clientx - strwrap.offset().left);
}
}else{
if(dragleft < -strmove.width() && dir < 0){
dragleft = 0;
strmoveleft = strmove.position().left;
k2 = strmoveleft - (e.clientx - strwrap.offset().left);
}
if(dragleft > 0 && dir > 0){
dragleft = -strmove.width();
strmoveleft = strmove.position().left;
k2 = strmoveleft - (e.clientx - strwrap.offset().left);
}
}
strmove.stop(true).css({
left: dragleft
});
}).on('mouseup', function () {
if(p.inverthover){
strmove.trigger('mouseenter')
}
$(this).off('mousemove');
settimeout(function () {
fmove = false
}, 50)
});
return false;
})
.on('click', function () {
if (fmove) {
return false
}
});
} else {
strwrap.addclass('no_drag');
};
}
} else {
if (p.runshort) {
var k2 = 0;
var timefunc = function () {
time = (strwrap.width() - strmove.position().left) / strwrap.data('scrollamount') * 1000;
return time;
};
var movefunc = function () {
var leftpos = strwrap.width();
strmove.animate({
left: leftpos
}, timefunc(), 'linear', function () {
$(this).css({
left: -strmove.width()
});
if (loop == -1) {
settimeout(movefunc, p.scrolldelay);
} else {
loop--;
settimeout(movefunc, p.scrolldelay);
};
});
};
strwrap.data({
movef : movefunc
})
if(!p.inverthover){
movefunc();
}
if (p.hoverstop) {
strwrap.on(enterevent, function () {
$(this).addclass('str_active');
strmove.stop(true);
}).on(leaveevent, function () {
$(this).removeclass('str_active');
$(this).off('mousemove');
movefunc();
});
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;
k2 = 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 = k2 + (e.clientx - strwrap.offset().left);
if(dragleft < -strmove.width() && dir < 0){
dragleft = strwrap.width();
strmoveleft = strmove.position().left;
k2 = strmoveleft - (e.clientx - strwrap.offset().left);
}
if(dragleft > strwrap.width() && dir > 0){
dragleft = -strmove.width();
strmoveleft = strmove.position().left;
k2 = strmoveleft - (e.clientx - strwrap.offset().left);
}
strmove.stop(true).css({
left:dragleft
});
}).on('mouseup', function () {
if(p.inverthover){
strmove.trigger('mouseenter')
}
$(this).off('mousemove');
settimeout(function () {
fmove = false
}, 50)
});
return false;
})
.on('click', function () {
if (fmove) {
return false
}
});
} else {
strwrap.addclass('no_drag');
};
}
} else {
strwrap.addclass('str_static');
}
};
};
if (p.direction == 'up') {
strwrap.addclass('str_vertical');
if (strmove.height() > strwrap.height()) {
var toppos = -strmove.height();
if (p.circular) {
if (!p.xml) {
circclonevert();
toppos = -(strmove.height() + (strmove.height() - strwrap.height()));
}
}
if (p.xml) {
strmove.css({
top:strwrap.height()
})
}
var
k2 = 0;
timefunc = function () {
var
fulls = math.abs(toppos),
time = (fulls / strwrap.data('scrollamount')) * 1000;
if (parsefloat(strmove.css('top')) != 0) {
fulls = (fulls + strwrap.height());
time = (fulls - (strwrap.height() - parsefloat(strmove.css('top')))) / strwrap.data('scrollamount') * 1000;
}
return time;
};
var movefunc = function () {
if (loop != 0) {
strmove.animate({
top: toppos
}, timefunc(), 'linear', function () {
$(this).css({
top: strwrap.height()
});
if (loop == -1) {
settimeout(movefunc, p.scrolldelay);
} else {
loop--;
settimeout(movefunc, p.scrolldelay);
};
});
};
};
strwrap.data({
movef : movefunc
})
if(!p.inverthover){
movefunc();
}
if (p.hoverstop) {
strwrap.on(enterevent, function () {
$(this).addclass('str_active');
strmove.stop(true);
}).on(leaveevent, function () {
$(this).removeclass('str_active');
$(this).off('mousemove');
movefunc();
});
if (p.drag) {
strwrap.on('mousedown', function (e) {
if(p.inverthover){
strmove.stop(true);
}
//drag
var dragtop;
var dir = 1;
var newy;
var oldy = e.clienty;
//drag
strmovetop = strmove.position().top;
k2 = strmovetop - (e.clienty - strwrap.offset().top);
$(this).on('mousemove', function (e) {
fmove = true;
//drag
newy = e.clienty;
if(newy > oldy){
dir = 1
}else{
if(newy < oldy){
dir = -1
}
}
oldy = newy
dragtop = k2 + e.clienty - strwrap.offset().top;
if (!p.circular){
if(dragtop < -strmove.height() && dir < 0){
dragtop = strwrap.height();
strmovetop = strmove.position().top;
k2 = strmovetop - (e.clienty - strwrap.offset().top);
}
if(dragtop > strwrap.height() && dir > 0){
dragtop = -strmove.height();
strmovetop = strmove.position().top;
k2 = strmovetop - (e.clienty - strwrap.offset().top);
}
}else{
if(dragtop < -strmove.height() && dir < 0){
dragtop = 0;
strmovetop = strmove.position().top;
k2 = strmovetop - (e.clienty - strwrap.offset().top);
}
if(dragtop > 0 && dir > 0){
dragtop = -strmove.height();
strmovetop = strmove.position().top;
k2 = strmovetop - (e.clienty - strwrap.offset().top);
}
}
strmove.stop(true).css({
top: dragtop
});
//drag
}).on('mouseup', function () {
if(p.inverthover){
strmove.trigger('mouseenter')
}
$(this).off('mousemove');
settimeout(function () {
fmove = false
}, 50)
});
return false;
})
.on('click', function () {
if (fmove) {
return false
}
});
} else {
strwrap.addclass('no_drag');
};
}
} else {
if (p.runshort) {
strmove.css({
top: strwrap.height()
});
var k2 = 0;
var timefunc = function () {
time = (strmove.height() + strmove.position().top) / strwrap.data('scrollamount') * 1000;
return time;
};
var movefunc = function () {
var toppos = -strmove.height();
strmove.animate({
top: toppos
}, timefunc(), 'linear', function () {
$(this).css({
top: strwrap.height()
});
if (loop == -1) {
settimeout(movefunc, p.scrolldelay);
} else {
loop--;
settimeout(movefunc, p.scrolldelay);
};
});
};
strwrap.data({
movef : movefunc
})
if(!p.inverthover){
movefunc();
}
if (p.hoverstop) {
strwrap.on(enterevent, function () {
$(this).addclass('str_active');
strmove.stop(true);
}).on(leaveevent, function () {
$(this).removeclass('str_active');
$(this).off('mousemove');
movefunc();
});
if (p.drag) {
strwrap.on('mousedown', function (e) {
if(p.inverthover){
strmove.stop(true);
}
//drag
var dragtop;
var dir = 1;
var newy;
var oldy = e.clienty;
//drag
strmovetop = strmove.position().top;
k2 = strmovetop - (e.clienty - strwrap.offset().top);
$(this).on('mousemove', function (e) {
fmove = true;
//drag
newy = e.clienty;
if(newy > oldy){
dir = 1
}else{
if(newy < oldy){
dir = -1
}
}
oldy = newy
dragtop = k2 + e.clienty - strwrap.offset().top;
if(dragtop < -strmove.height() && dir < 0){
dragtop = strwrap.height();
strmovetop = strmove.position().top;
k2 = strmovetop - (e.clienty - strwrap.offset().top);
}
if(dragtop > strwrap.height() && dir > 0){
dragtop = -strmove.height();
strmovetop = strmove.position().top;
k2 = strmovetop - (e.clienty - strwrap.offset().top);
}
//*drag
strmove.stop(true).css({
top: dragtop
});
}).on('mouseup', function () {
if(p.inverthover){
strmove.trigger('mouseenter')
}
$(this).off('mousemove');
settimeout(function () {
fmove = false
}, 50)
});
return false;
})
.on('click', function () {
if (fmove) {
return false
}
});
} else {
strwrap.addclass('no_drag');
};
}
} else {
strwrap.addclass('str_static');
}
};
};
if (p.direction == 'down') {
strwrap.addclass('str_vertical').addclass('str_down');
strmove.css({
top: -strmove.height(),
bottom: 'auto'
})
if (strmove.height() > strwrap.height()) {
var toppos = strwrap.height();
if (p.circular) {
if (!p.xml) {
circclonevert();
toppos = strmove.height();
}
}
if (p.xml) {
strmove.css({
top:-strmove.height()
})
}
var
k2 = 0;
timefunc = function () {
var
fulls = strwrap.height(), //крайняя точка
time = (fulls / strwrap.data('scrollamount')) * 1000; //время
if (parsefloat(strmove.css('top')) != 0) {
fulls = (strmove.height() + strwrap.height());
time = (fulls - (strmove.height() + parsefloat(strmove.css('top')))) / strwrap.data('scrollamount') * 1000;
}
return time;
};
var movefunc = function () {
if (loop != 0) {
strmove.animate({
top: toppos
}, timefunc(), 'linear', function () {
$(this).css({
top: -strmove.height()
});
if (loop == -1) {
settimeout(movefunc, p.scrolldelay);
} else {
loop--;
settimeout(movefunc, p.scrolldelay);
};
});
};
};
strwrap.data({
movef : movefunc
})
if(!p.inverthover){
movefunc();
}
if (p.hoverstop) {
strwrap.on(enterevent, function () {
$(this).addclass('str_active');
strmove.stop(true);
}).on(leaveevent, function () {
$(this).removeclass('str_active');
$(this).off('mousemove');
movefunc();
});
if (p.drag) {
strwrap.on('mousedown', function (e) {
if(p.inverthover){
strmove.stop(true);
}
//drag
var dragtop;
var dir = 1;
var newy;
var oldy = e.clienty;
//drag
strmovetop = strmove.position().top;
k2 = strmovetop - (e.clienty - strwrap.offset().top);
$(this).on('mousemove', function (e) {
fmove = true;
//drag
newy = e.clienty;
if(newy > oldy){
dir = 1
}else{
if(newy < oldy){
dir = -1
}
}
oldy = newy
dragtop = k2 + e.clienty - strwrap.offset().top;
if (!p.circular){
if(dragtop < -strmove.height() && dir < 0){
dragtop = strwrap.height();
strmovetop = strmove.position().top;
k2 = strmovetop - (e.clienty - strwrap.offset().top);
}
if(dragtop > strwrap.height() && dir > 0){
dragtop = -strmove.height();
strmovetop = strmove.position().top;
k2 = strmovetop - (e.clienty - strwrap.offset().top);
}
}else{
if(dragtop < -strmove.height() && dir < 0){
dragtop = 0;
strmovetop = strmove.position().top;
k2 = strmovetop - (e.clienty - strwrap.offset().top);
}
if(dragtop > 0 && dir > 0){
dragtop = -strmove.height();
strmovetop = strmove.position().top;
k2 = strmovetop - (e.clienty - strwrap.offset().top);
}
}
strmove.stop(true).css({
top: dragtop
});
//drag
}).on('mouseup', function () {
if(p.inverthover){
strmove.trigger('mouseenter')
}
$(this).off('mousemove');
settimeout(function () {
fmove = false
}, 50)
});
return false;
})
.on('click', function () {
if (fmove) {
return false
}
});
} else {
strwrap.addclass('no_drag');
};
}
} else {
if (p.runshort) {
var k2 = 0;
var timefunc = function () {
time = (strwrap.height() - strmove.position().top) / strwrap.data('scrollamount') * 1000;
return time;
};
var movefunc = function () {
var toppos = strwrap.height();
strmove.animate({
top: toppos
}, timefunc(), 'linear', function () {
$(this).css({
top: -strmove.height()
});
if (loop == -1) {
settimeout(movefunc, p.scrolldelay);
} else {
loop--;
settimeout(movefunc, p.scrolldelay);
};
});
};
strwrap.data({
movef : movefunc
})
if(!p.inverthover){
movefunc();
}
if (p.hoverstop) {
strwrap.on(enterevent, function () {
$(this).addclass('str_active');
strmove.stop(true);
}).on(leaveevent, function () {
$(this).removeclass('str_active');
$(this).off('mousemove');
movefunc();
});
if (p.drag) {
strwrap.on('mousedown', function (e) {
if(p.inverthover){
strmove.stop(true);
}
//drag
var dragtop;
var dir = 1;
var newy;
var oldy = e.clienty;
//drag
strmovetop = strmove.position().top;
k2 = strmovetop - (e.clienty - strwrap.offset().top);
$(this).on('mousemove', function (e) {
fmove = true;
//drag
newy = e.clienty;
if(newy > oldy){
dir = 1
}else{
if(newy < oldy){
dir = -1
}
}
oldy = newy
dragtop = k2 + e.clienty - strwrap.offset().top;
if(dragtop < -strmove.height() && dir < 0){
dragtop = strwrap.height();
strmovetop = strmove.position().top;
k2 = strmovetop - (e.clienty - strwrap.offset().top);
}
if(dragtop > strwrap.height() && dir > 0){
dragtop = -strmove.height();
strmovetop = strmove.position().top;
k2 = strmovetop - (e.clienty - strwrap.offset().top);
}
//*drag
strmove.stop(true).css({
top: dragtop
});
}).on('mouseup', function () {
if(p.inverthover){
strmove.trigger('mouseenter')
}
$(this).off('mousemove');
settimeout(function () {
fmove = false
}, 50)
})
return false;
})
.on('click', function () {
if (fmove) {
return false
}
});
} else {
strwrap.addclass('no_drag');
};
}
} else {
strwrap.addclass('str_static');
}
};
};
}
if (p.xml) {
$.ajax({
url: p.xml,
datatype: "xml",
success: function (xml) {
var xmltextel = $(xml).find('text');
var xmltextlength = xmltextel.length;
for(var i = 0; i < xmltextlength; i++){
var xmlelactive = xmltextel.eq(i);
var xmlelcontent = xmlelactive.text();
var xmlitemel = $('').text(xmlelcontent).appendto(strwrap);
if(p.direction == 'left' || p.direction == 'right'){
xmlitemel.css({display:'inline-block',textalign:'right'});
if(i > 0){
xmlitemel.css({width:strwrap.width()+xmlitemel.width()});
}
}
if(p.direction == 'down' || p.direction == 'up'){
xmlitemel.css({display:'block',textalign:'left'});
if(i > 0){
xmlitemel.css({paddingtop:strwrap.height()});
}
}
}
code();
}
});
} else {
code();
}
strwrap.data({
ini:code,
startheight: startheight
})
});
},
update: function () {
var el = $(this);
var str_origin = $('.str_origin',el);
var str_move_clone = $('.str_move_clone',el);
str_origin.stop(true);
str_move_clone.remove();
el.data('ini')();
},
destroy: function () {
var el = $(this);
var elmove = $('.str_move',el);
var startheight = el.data('startheight');
$('.str_move_clone',el).remove();
el.off('mouseenter');
el.off('mousedown');
el.off('mouseup');
el.off('mouseleave');
el.off('mousemove');
el.removeclass('nostop').removeclass('str_vertical').removeclass('str_active').removeclass('no_drag').removeclass('str_static').removeclass('str_right').removeclass('str_down');
var elstyle = el.attr('style');
if(elstyle){
var stylearr = elstyle.split(';');
for(var i=0; i < stylearr.length; i++){
var str = $.trim(stylearr[i]);
var tested = str.search(/^height/g);
if(tested != -1){
stylearr[i] = '';
}
}
var newarr = stylearr.join(';');
var newstyle = newarr.replace(/;+/g,';')
if(newstyle == ';'){
el.removeattr('style');
}else{
el.attr('style',newstyle);
}
if(startheight){
el.css({height:startheight})
}
}
elmove.stop(true);
if(elmove.length){
var context = elmove.html();
elmove.remove();
el.html(context);
}
},
pause: function(){
var el = $(this);
var elmove = $('.str_move',el);
elmove.stop(true);
},
play: function(){
var el = $(this);
$(this).off('mousemove');
el.data('movef')();
}
};
$.fn.limarquee = function (method) {
if (methods[method]) {
return methods[method].apply(this, array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('метод ' + method + ' в jquery.limarquee не существует');
}
};
})(jquery);