1 thủ thuật khá đơn giản là chúng ta sử dụng Jquery để làm được slide ảnh đó. Ở bài viết này mình gửi tới các bạn code và hướng dẫn thủ thuật trên blogger
Demo trực tiếp
Code:
<style>
.nivoSlider {
position:relative;
}
.nivoSlider img {
position:absolute;
top:0px;
left:0px;
}
.nivoSlider a.nivo-imageLink {
position:absolute;
top:0px;
left:0px;
width:100%;
height:100%;
border:0;
padding:0;
margin:0;
z-index:60;
display:none;
}
/* The slices in the Slider */
.nivo-slice {
display:block;
position:absolute;
z-index:50;
height:100%;
}
/* Caption styles */
.nivo-caption {
position:absolute;
left:0px;
bottom:0px;
background:#000;
color:#fff;
opacity:0.8; /* Overridden by captionOpacity setting */
width:100%;
z-index:89;
}
.nivo-caption p {
padding:5px;
margin:0;
}
.nivo-caption a {
display:inline !important;
}
.nivo-html-caption {
display:none;
}
/* Direction nav styles (e.g. Next & Prev) */
.nivo-directionNav a {
position:absolute;
top:45%;
z-index:99;
cursor:pointer;
}
.nivo-prevNav {
left:0px;
}
.nivo-nextNav {
right:0px;
}
/* Control nav styles (e.g. 1,2,3...) */
.nivo-controlNav a {
position:relative;
z-index:99;
cursor:pointer;
}
.nivo-controlNav a.active {
font-weight:bold;
}
table {
border-collapse:separate;
border-spacing:0;
}
caption, th, td {
text-align:left;
font-weight:normal;
}
blockquote:before, blockquote:after,
q:before, q:after {
content:"";
}
blockquote, q {
quotes:"" "";
}
/* HTML5 tags */
header, section, footer,
aside, nav, article, figure {
display: block;
}
a, a:visited {
color:#2d3536;
text-decoration:none;
border-bottom:1px dotted #826a4d;
}
a:hover, a:active {
color:#9e805c;
text-decoration:none;
}
#slider-wrapper {
background:url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIb7MSSxiHA41Brwa93u7SixyezwJM6jeBvYDMssRCy4VjDeub3yZnry87PoU6_J0XBPO2V-9NQSoQAJVPgxQNsIeN-9Pfg0a-tEvTyBLPRHZ6Gg4enTzoBjaAQMKGHFB4D1l5CTqcvpc/s1600/slider.png) no-repeat;
width:494px;
height:310px;
margin:0 auto;
padding-top:23px;
margin-top:50px;
}
#slider {
position:relative;
width:430px;
height:250px;
margin-left:32px;
background:url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQQjrvXkEodtqyz9sMWpb9czrdOvXBwbcNCShHgWuv1UvoWq_ZiGG-Ge_uyOVoM6hLR15CU3yGl_6ph5AFv-CphhHmg1QmFsWQlKH_Cl4QLoc1Iz2cOUk4P9ZY-sNyYk15a9lrn60DPpk/s1600/loading.gif) no-repeat 50% 50%;
}
#slider img {
position:absolute;
top:0px;
left:0px;
display:none;
}
#slider a {
border:0;
display:block;
}
.nivo-controlNav {
position:absolute;
left:163px;
bottom:12px;
background: #000000;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
padding: 3px;
border: 2px solid #CCC;
opacity: 0.7;
z-index: 99;
}
.nivo-controlNav:hover{opacity: 1;}
.nivo-controlNav a {
display:block;
width:22px;
height:22px;
background:url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiC6M07euqT3RAgIdt_fW863MEHyBxATot5uI9FB7WSVCphBOM96UN9QR-1pDaypgIZDIuqOIZAHfX-sfLT3UDdoNmL71z-Y1PEHzEFWyqtEcKVG9R3JEAlIPMSzc5BO3FSsb9GFGHiNGc/s1600/bullets.png) no-repeat;
text-indent:-9999px;
border:0;
margin-right:0px;
float:left;
}
.nivo-controlNav a.active {
background-position:0 -22px;
}
.nivo-directionNav a {
display:block;
width:35px;
height:65px;
background:url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDMaHkJA6oXaATB4JYt_isin8rb7cnSXX4rfn3BGGm_Orp1XFWlm6KLvAi98k8mA4a7MrQtQ8lkGlxFytZDcEux_ejcc8ji8K36WflEwzLD1kmKDSZytQGhyphenhyphenVyp8eosaBsmAbdvYOMSf0/s1600/arrows.png) no-repeat;
text-indent:-9999px;
border:0;
}
a.nivo-nextNav {
background-position:-35px 0;
right: -40px;
}
a.nivo-nextNav:hover{right: -41px;}
a.nivo-prevNav {
left:-40px;
}
a.nivo-prevNav:hover{left: -41px;}
.nivo-caption {
text-shadow:none;
font-family: Helvetica, Arial, sans-serif;
}
.nivo-caption a {
color:#efe9d1;
text-decoration:underline;
}
.nivo-directionNav a{top: 40%;}
.clear {
clear:both;
}
</style>
<br />
<div id="wrapper">
<div id="slider-wrapper">
<div class="nivoSlider" id="slider">
<img alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD7O6Ow-mNme2jbAVuL8YvVXoGRS0hScjVkPhYEPDpfeJPEpJ-BMBJjLDGhZr5EX-l80I0Y_Nc7MuGcJNchZ1Uca9BQ7KNIZcMCh1TVb4pNa4Vdg4jWoDSaICvh6-KhpkcMoJDHrCtZBo/s1600/btrix-London_Barrier.jpg" />
<img alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinSUZn3G9ixJ48IZgO5ro9jUfo6O0fKsK-h-NkOqxGFGLwXv9OFWmxTtZiZ4pt1TOAkUntWYx2JXWqr9yfk-T0NPv6KZLWIPd51NfL4fbM0ldfgbmXiVGJKPK0D3z5TPtgXSY4C61-Ed8/s1600/btrix-sunset.jpg" />
<img alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6jCkttymTaqlR3YeUY2lGS0YCB2yZ7Ze1hZAsqN9RjlvAgBy3csOzj196JTharx4prtLZmWVgXclxSx8UN5ltjIUMimW7fZaHH_RfAzjlPeWQr6cFAO5eMr66UGoEVw7wAUDnymyJC7U/s1600/btrix-car-wallpapers.jpg" />
<img alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVi40PIwlqmw34tz4BywLwaDMaFQY73Xd0hbxGJobL3zxiYYWkDvZhlFLEUlP1YrdP0-EpFiaarI34XJY92ls72ExkAaT3UPV9OkRp4_g_Kk5AXnePkJb_8Ld9M4SwSyWNTRr9prbjz90/s1600/btrix-spring-nature.jpg" />
</div>
</div>
</div>
<script src="http://bloggertrixcode.googlecode.com/files/jquery-1.4.3.min.js" type="text/javascript"></script>
<script src="http://bloggertrixcode.googlecode.com/files/jquery.nivo.slider.pack.js" type="text/javascript"></script>
<script type="text/javascript">
$(window).load(function() {
$('#slider').nivoSlider({directionNavHide:false});
});
</script>
Trong đó:
Code bôi xanh là CSS, Code bôi đỏ là HTML + Javascript.
Link hình ảnh các bạn thay thế bằng ảnh của mình.
Hướng dẫn thêm cho blogspot:
- Thêm 1 tiện ích và dán Code ở trên vào tiện ích đó. Tiện ích HTML/ Javascript đó nên thêm ở trên phần bài đăng.
Không có nhận xét nào:
Đăng nhận xét