10/8/13

Jquery Image Slider - Slide ảnh với thanh trượt ngang cho Blogspot

Đối với Slider thì việc sử dụng làm điểm nhấn cho blog, website là điều cần thiết. 1 Slide đẹp và mượt mà luôn được người dùng hướng tới. Bài viết này itviet360 chia sẻ với bạn code và cách làm thêm 1 Jquery Image Slider - Slide ảnh với thanh trượt ngang cho Blogspot cũng như trên website khác
DEMO

- Vào bảng điều khiển Blogger -> Mẫu (Template) -> Chỉnh sửa mẫu (Edit HTML)
- Tìm tới </head>  và dán code dưới đây ngay trên nó

<link href='https://bloggertrixcode.googlecode.com/files/animate.css' rel='stylesheet' type='text/css'/>

<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'/>

<script src='https://bloggertrixcode.googlecode.com/files/border-slider.js'/>

<script>/****/

jQuery(document).ready(function(){

jQuery('#bloggertrix_slider').animatedSlider({

'loader':true,

'width':900,

'height':300,

'slide_animation_data' :

[//slides

//slide1 BEGIN

[

{

'target_element':'.txt1',

'animation_frame':0,

'animation_type':'tada'

},{

'target_element':'.txt2',

'animation_frame':0.8,

'animation_type':'tada'

}

],//slide1 END



//slide2 BEGIN

[{

'target_element':'img',

'animation_frame':0,

'animation_type':'bounceInUp'

},{

'target_element':'p',

'animation_frame':0.7,

'animation_type':'bounceInUp'

}],//slide2 END

//slide3 BEGIN

[{

'target_element':'img',

'animation_frame':0,

'animation_type':'bounceInUp'

},{

'target_element':'p',

'animation_frame':0.6,

'animation_type':'bounceInUp'

}],//slide3 END



//slide4 BEGIN

[{

'target_element':'img',

'animation_frame':0,

'animation_type':'bounceInUp'

},{

'target_element':'p',

'animation_frame':0.5,

'animation_type':'bounceInUp'

}],//slide4 END

//slide5 BEGIN

[{

'target_element':'img',

'animation_frame':0,

'animation_type':'bounceInUp'

},{

'target_element':'p',

'animation_frame':0.4,

'animation_type':'bounceInUp'

}],//slide5 END



//slide BEGIN

[{

'target_element':'h1',

'animation_frame':0,

'animation_type':'bounceInUp'

},{

'target_element':'p',

'animation_frame':0.3,

'animation_type':'bounceInUp'

}

]//slide END

]});});

</script>

<link href='http://fonts.googleapis.com/css?family=Kavoon' rel='stylesheet' type='text/css'/>

- Tiếp theo tìm tới ]]></b:skin> và dán code dưới đây ngay trên nó

/* The CSS Code for the slider starts here bloggertrix.com

#bloggertrix_slider {margin:0 auto;}

#bloggertrix_slider .slider-contents {overflow:hidden;border:8px solid #DDDDDD;box-shadow:0 0 3px rgba(3,3,3,0.5);}

#bloggertrix_slider .slide-nav {float:left;padding: 0 8px;height: 26px;background: #3a3a3a;}

#bloggertrix_slider .slide-nav a {width: 14px;height: 14px;text-indent: -999px;float: left;list-style: none;display: block;background: #dddddd;margin: 5px 4px;cursor: pointer;}

#bloggertrix_slider .slide-nav a:hover {

background: #27BAFF !important;}

#bloggertrix_slider .progress-bar {width:0px;background-color:#AAAAAA;height:2px;top: -2px;overflow:visible !important;display:block !important;position: relative;}

#bloggertrix_slider .controls {height: 26px;margin: 4px auto 0;display: table;}

#bloggertrix_sliderr .pause-play-control {width: 46px;height: 26px;float: left;background: #3A3A3A;color: #fff;}

#bloggertrix_slider .pause-play-control a {width:9px;height: 19px;display:block;overflow:hidden;text-indent: -9999px;background:url('http://img837.imageshack.us/img837/7647/fqnu.png');cursor: pointer;margin:3px auto 0;}

#bloggertrix_slider .pause-play-control a.play-slide {background-position:-5px -3px;}

#bloggertrix_slider .pause-play-control a.pause-slide {background-position:-29px -3px;}

#bloggertrix_slider .slider-next,#bloggertrix_slider .slider-prev {

width: 46px;height: 46px;background: #3a3a3a;display: block;font-size: 41px;color: #FFF;font-weight: bold;text-align: center;position: absolute;cursor: pointer;text-indent: -999px;overflow: hidden;}

#bloggertrix_slider .slider-next:before,#bloggertrix_slider .slider-prev:before {background: #3a3a3a url('http://img837.imageshack.us/img837/7647/fqnu.png');width:32px;height:32px;position:relative;top:7px;left:7px;content:'';display:block;}

/*#bloggertrix_slider .slider-next {margin: -220px 0 0 681px;}

#bloggertrix_slider .slider-prev {margin: -220px 0 0 4px;}*/

#bloggertrix_slider .slider-next:before {background-position:-5px -31px;}

#bloggertrix_slider .slider-prev:before {background-position:-5px -70px;}

.slide1 img {position:relative;}

.img-logo {margin-left: 150px;}

.img-mobile {margin-top: 45px;}

.img-tablet {margin: -168px 0 0 139px;}

.img-laptop {margin: -186px 0 0 349px;}

.slide1 {background-color: #67b608}

.slide2 {background-color: #03bbd3}

.slide3 {background-color: #cf6b30}

.slide4 {background-color: #f2a87b}

.slide5 {background-color: #388efd}

- Lưu mẫu lại
- Vào bố cục (Layout) -> Thêm tiện ích (Add a Widget) -> HTML/Javascript
- Dán code dưới đây vào nó

<div id="bloggertrix_slider">

<div class="slide1">

<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwMk2j7Uu10Re3ab8oJUqg85uXz6ww0r_2gP1CwbPlKYRY5hsRtg9TxLkrLb-qAFQmFL7Ht9aHBVWbSIrCrXLYCGTwm2PmwbW6FdOOK-yY-kb-o3yo18sEqGF-fdlFohU_TpH4Gqcpg9c/s1600/bloggertrix1.jpg" />

</div>

<div class="slide2">

<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpyR1JnokgeqWeIHUFc8iIBMChdgy2kx2OpEOyxEEnH1Jlb_GrozQFqTr0J2lPCT5j5iCT83NVUXEcbYn2Q714QOjcE9XQ7V3cCfoarAk0dFGFzduyS8pv4prwCSqIvEM2MjpWF7G4n3I/s1600/bloggertrix2.jpg" />

</div>

<div class="slide3">

<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgofRg_dyMeCJf2n7PZ6QJQPeOCGEGlpRzFKKl8seVsFDrdxdLzz-sC1s7ny1te93Si9Apn27G4amf6CQcE4C_9i12XxqQeds3v64x5K0rzXByy2Ct-yH8yQ_mH48owvwyxeoke5UnSkto/s1600/bloggertrix3.jpg" />

</div>

<div class="slide4">

<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigYE5teAzeHjM1nfZ2d11viywiJNuSpgeHZZFxHuB_aIBHEtYn2kl5mXhpc1tZW5uEpzbHA07S4fv83CGFK_1cuGkxG6Auzd_wVbTPc0o0dHLyWUaR6MinOeOay95uJy2PNh7coV1EWf8/s1600/bloggertrix4.jpg" />

</div>

<div class="slide5">

<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPm9kcZb7SDa2hyphenhyphenYf5g2bH_mzOCywfv6Vnl3dbkHD8yTO8ZkUtVlI2LZ3eDTJ47_sKQ3m0-5lowL_83cnP6Yb3UmkW2lgYDsU_QLCbuA4K-f4Ji0wEc1uk3UMcOqIZTDNQfXdI9Nkf6uw/s1600/bloggertrix5.jpg" />

</div>

</div>

- Lưu và xem kết quả :)

0 nhận xét:

Post a Comment