Cum sa fac ca un banner sa se miste? cel de sus ?
Cod:
(function($) {
$.extend($.fx.step,{
backgroundPosition: function(fx) {
if (fx.state === 0 && typeof fx.end == 'string') {
var start = $.curCSS(fx.elem,'backgroundPosition');
start = toArray(start);
fx.start = [start[0],start[2]];
var end = toArray(fx.end);
fx.end = [end[0],end[2]];
fx.unit = [end[1],end[3]];
}
var nowPosX = [];
nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];
fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];
function toArray(strg){
strg = strg.replace(/left|top/g,'0px');
strg = strg.replace(/right|bottom/g,'100%');
strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
}
}
});
})(jQuery);
Cod:
$(function() {
var backgroundpos = 0;
var offset = 1;
function scrollbackground() {
offset = (offset < 1) ? offset + (backgroundpos - 1) : offset - 1;
$('#id logo').css("background-position", + offset + "px 0");
setTimeout(function() {
scrollbackground();
}, 100
);
}
scrollbackground();
});
Cod:
#pun-logo {
-moz-transition-duration: 1.5s;
-webkit-transition-duration: 1.5s;
-o-transition-duration: 1.5s;
}
#pun-logo:hover{
margin-left:100px;
}
Cod:
#logo-desc{background:url("http://i41.servimg.com/u/f41/12/51/77/36/avnr310.png");
-webkit-transition-duration: 1.5s;
-moz-transition-duration: 1.5s;
-o-transition-duration: 1.5s;
transition-duration: 1.5s;}
Cod:
#logo-desc:hover {margin-left: 75px;}