<div id="overflow">
<div id="midground"></div>
<div id="foreground"></div>
</div>
<div id="content">
<!-- content goes here -->
</div>
, .
#overflow { width: 100%; overflow: hidden; height: 500px; position: absolute; }
, , :
#midground {
background: transparent url(bg-mid.png) left top repeat-x;
margin: 0; padding: 0; width: 1000%;
position: absolute; top: 0;
height: 600px;
z-index: 1;
}
#foreground {
background: transparent url(bg-front.png) left top repeat-x;
margin: 0; padding: 0; width: 1000%; height: 200px;
position: absolute; top: 0; left: -9000px;
z-index: 2;
}
3. jQuery
, :
init.js: $(document).ready(function() {
$('#midground').animate({left: "-=9000px"}, { easing: "linear", duration:120000 });
$('#foreground').animate({left: "+=9000px"}, { easing: "linear", duration:120000 });
});
, , .
1. $(document).ready — html/js .
2. $() - jQuery, css- xpath
3. $.animate() - , css (easing)
4. $.animate({left: "+=9000px"}) - - . - .
5. {easing: "linear", duration: 120000} - (easing) "linear", , , .. jQuery "swing". .. . duration: 120000 - , self-explanatory, .
6. , - , :)
, , , .
! :)
: Firefox 2, Opera 9.26, Internet Explorer 7, Safari 3.0.4.
IE 6 , - , :)
, .
#overflow { width: 100%; overflow: hidden; height: 500px; position: absolute; }
, , :
#midground {
background: transparent url(bg-mid.png) left top repeat-x;
margin: 0; padding: 0; width: 1000%;
position: absolute; top: 0;
height: 600px;
z-index: 1;
}
#foreground {
background: transparent url(bg-front.png) left top repeat-x;
margin: 0; padding: 0; width: 1000%; height: 200px;
position: absolute; top: 0; left: -9000px;
z-index: 2;
}
3. jQuery
, :
init.js: $(document).ready(function() {
$('#midground').animate({left: "-=9000px"}, { easing: "linear", duration:120000 });
$('#foreground').animate({left: "+=9000px"}, { easing: "linear", duration:120000 });
});
, , .
1. $(document).ready — html/js .
2. $() - jQuery, css- xpath
3. $.animate() - , css (easing)
4. $.animate({left: "+=9000px"}) - - . - .
5. {easing: "linear", duration: 120000} - (easing) "linear", , , .. jQuery "swing". .. . duration: 120000 - , self-explanatory, .
6. , - , :)
, , , .
! :)
: Firefox 2, Opera 9.26, Internet Explorer 7, Safari 3.0.4.
IE 6 , - , :)
, .
#overflow { width: 100%; overflow: hidden; height: 500px; position: absolute; }
, , :
#midground {
background: transparent url(bg-mid.png) left top repeat-x;
margin: 0; padding: 0; width: 1000%;
position: absolute; top: 0;
height: 600px;
z-index: 1;
}
#foreground {
background: transparent url(bg-front.png) left top repeat-x;
margin: 0; padding: 0; width: 1000%; height: 200px;
position: absolute; top: 0; left: -9000px;
z-index: 2;
}
3. jQuery
, :
init.js: $(document).ready(function() {
$('#midground').animate({left: "-=9000px"}, { easing: "linear", duration:120000 });
$('#foreground').animate({left: "+=9000px"}, { easing: "linear", duration:120000 });
});
, , .
1. $(document).ready — html/js .
2. $() - jQuery, css- xpath
3. $.animate() - , css (easing)
4. $.animate({left: "+=9000px"}) - - . - .
5. {easing: "linear", duration: 120000} - (easing) "linear", , , .. jQuery "swing". .. . duration: 120000 - , self-explanatory, .
6. , - , :)
, , , .
! :)
: Firefox 2, Opera 9.26, Internet Explorer 7, Safari 3.0.4.
IE 6 , - , :)
, .
#overflow { width: 100%; overflow: hidden; height: 500px; position: absolute; }
, , :
#midground {
background: transparent url(bg-mid.png) left top repeat-x;
margin: 0; padding: 0; width: 1000%;
position: absolute; top: 0;
height: 600px;
z-index: 1;
}
#foreground {
background: transparent url(bg-front.png) left top repeat-x;
margin: 0; padding: 0; width: 1000%; height: 200px;
position: absolute; top: 0; left: -9000px;
z-index: 2;
}
3. jQuery
, :
init.js: $(document).ready(function() {
$('#midground').animate({left: "-=9000px"}, { easing: "linear", duration:120000 });
$('#foreground').animate({left: "+=9000px"}, { easing: "linear", duration:120000 });
});
, , .
1. $(document).ready — html/js .
2. $() - jQuery, css- xpath
3. $.animate() - , css (easing)
4. $.animate({left: "+=9000px"}) - - . - .
5. {easing: "linear", duration: 120000} - (easing) "linear", , , .. jQuery "swing". .. . duration: 120000 - , self-explanatory, .
6. , - , :)
, , , .
! :)
: Firefox 2, Opera 9.26, Internet Explorer 7, Safari 3.0.4.
IE 6 , - , :)
, .
#overflow { width: 100%; overflow: hidden; height: 500px; position: absolute; }
, , :
#midground {
background: transparent url(bg-mid.png) left top repeat-x;
margin: 0; padding: 0; width: 1000%;
position: absolute; top: 0;
height: 600px;
z-index: 1;
}
#foreground {
background: transparent url(bg-front.png) left top repeat-x;
margin: 0; padding: 0; width: 1000%; height: 200px;
position: absolute; top: 0; left: -9000px;
z-index: 2;
}
3. jQuery
, :
init.js: $(document).ready(function() {
$('#midground').animate({left: "-=9000px"}, { easing: "linear", duration:120000 });
$('#foreground').animate({left: "+=9000px"}, { easing: "linear", duration:120000 });
});
, , .
1. $(document).ready — html/js .
2. $() - jQuery, css- xpath
3. $.animate() - , css (easing)
4. $.animate({left: "+=9000px"}) - - . - .
5. {easing: "linear", duration: 120000} - (easing) "linear", , , .. jQuery "swing". .. . duration: 120000 - , self-explanatory, .
6. , - , :)
, , , .
! :)
: Firefox 2, Opera 9.26, Internet Explorer 7, Safari 3.0.4.
IE 6 , - , :)
Source: https://habr.com/ru/post/21070/
All Articles