Hot File

Create Photo Gallery with AngularJS and CSS3

View: 818    Dowload: 0   Comment: 0   Post by: hanhga  
Author: none   Category: References   Fields: Other

9 point/5 review File has been tested

Today I'll show you how to make a photo gallery effect with the help of AngularJS and CSS3. This slideshow was not complex but very easy to apply for the website or web app. Through this article, you will have experience in creating 3D effects with CSS3 and also learn more about using AngularJS, a web app Frameword for the much in vogue today.

Introduction

Today I'll show you how to make a photo gallery effect with the help of AngularJS and CSS3. This slideshow was not complex but very easy to apply for the website or web app. Through this article, you will have experience in creating 3D effects with CSS3 and also learn more about using AngularJS, a web app Frameword for the much in vogue today.

HTML

First, you insert the declaration for angular.js and the necessary files are as follows:

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE html>
<html ng-app="photogallery">
<head>
    <meta charset="utf-8" />
    <meta name="author" content="Script Tutorials" />
    <title>Tạo Photo Gallery với AngularJS và CSS3</title>
    <meta name="description" content="Photo Gallery with AngularJS and CSS3 - demo page">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
 
    <!-- add styles -->
    <link href="demo.css" rel="stylesheet" type="text/css" />
     <link rel="icon" href="http://www.thuthuatweb.net/wp-content/themes/HostingSite/favicon.ico" type="image/x-ico"/>
    <!-- add javascripts -->
    <script src="js/jquery-2.0.3.min.js"></script>
    <script src="http://code.angularjs.org/1.2.0rc1/angular.js"></script>
    <script src="js/app.js"></script>
</head>

Next is insert the following into the <body>

1
<body ng-controller="MainCtrl">

Continuing, insert the following html snippet to create standard framework for gallery

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
<!-- slider container -->
    <div class="container slider">
 
        <!-- enumerate all photos -->
        <img ng-repeat="photo in photos" class="slide" ng-swipe-right="showPrev()" ng-swipe-left="showNext()" ng-show="isActive($index)" ng-src="{{photo.src}}" />
 
        <!-- prev / next controls -->
        <a class="arrow prev" href="#" ng-click="showPrev()"></a>
        <a class="arrow next" href="#" ng-click="showNext()"></a>
 
        <!-- extra navigation controls -->
        <ul class="nav">
            <li ng-repeat="photo in photos" ng-class="{'active':isActive($index)}">
                <img ng-src="{{photo.src}}" alt="{{photo.desc}}" title="{{photo.desc}}" ng-click="showPhoto($index);" />
            </li>
        </ul>
 
    </div>

CSS

To create a 3D effect to the image, the entire paragraph you use the following css:

001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
.arrow {
    cursor: pointer;
    display: block;
    height: 64px;
    margin-top: -35px;
    outline: medium none;
    position: absolute;
    top: 50%;
    width: 64px;
    z-index: 5;
}
.arrow.prev {
    background-image: url("../images/prev.png");
    left: 20px;
    opacity: 0.2;
    transition: all 0.2s linear 0s;
}
.arrow.next {
    background-image: url("../images/next.png");
    opacity: 0.2;
    right: 20px;
    transition: all 0.2s linear 0s;
}
.arrow.prev:hover{
    opacity:1;
}
.arrow.next:hover{
    opacity:1;
}
 
.nav {
    bottom: -4px;
    display: block;
    height: 48px;
    left: 0;
    margin: 0 auto;
    padding: 1em 0 0.8em;
    position: absolute;
    right: 0;
    text-align: center;
    width: 100%;
    z-index: 5;
}
.nav li {
    border: 5px solid #AAAAAA;
    border-radius: 5px;
    cursor: pointer;
    display: inline-block;
    height: 30px;
    margin: 0 8px;
    position: relative;
    width: 50px;
}
.nav li.active {
    border: 5px solid #FFFFFF;
}
.nav li img {
    width: 100%;
}
 
.slider {
    border: 15px solid #FFFFFF;
    border-radius: 5px;
    height: 500px;
    margin: 20px auto;
    position: relative;
    width: 800px;
 
    -webkit-perspective: 1000px;
    -moz-perspective: 1000px;
    -ms-perspective: 1000px;
    -o-perspective: 1000px;
    perspective: 1000px;
 
    -webkit-transform-style: preserve-3d;
    -moz-transform-style: preserve-3d;
    -ms-transform-style: preserve-3d;
    -o-transform-style: preserve-3d;
    transform-style: preserve-3d;
}
.slide {
    position: absolute;
    top: 0;
    left: 0;
}
.slide.ng-hide-add {
    opacity:1;
 
    -webkit-transition:1s linear all;
    -moz-transition:1s linear all;
    -o-transition:1s linear all;
    transition:1s linear all;
 
    -webkit-transform: rotateX(50deg) rotateY(30deg);
    -moz-transform: rotateX(50deg) rotateY(30deg);
    -ms-transform: rotateX(50deg) rotateY(30deg);
    -o-transform: rotateX(50deg) rotateY(30deg);
    transform: rotateX(50deg) rotateY(30deg);
 
    -webkit-transform-origin: right top 0;
    -moz-transform-origin: right top 0;
    -ms-transform-origin: right top 0;
    -o-transform-origin: right top 0;
    transform-origin: right top 0;
}
.slide.ng-hide-add.ng-hide-add-active {
    opacity:0;
}
.slide.ng-hide-remove {
    -webkit-transition:1s linear all;
    -moz-transition:1s linear all;
    -o-transition:1s linear all;
    transition:1s linear all;
 
    display:block!important;
    opacity:0;
}
.slide, .slide.ng-hide-remove.ng-hide-remove-active {
    opacity:1;
}

JavaScript

This is the entire script that you need to use the gallery running.

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'use strict';
 
angular.module('photogallery', ['ngAnimate', 'ngTouch'])
  .controller('MainCtrl', function ($scope) {
 
    // Set of Photos
    $scope.photos = [
        {src: 'https://farm9.staticflickr.com/8042/7918423710_e6dd168d7c_b.jpg', desc: 'Image 01'},
        {src: 'https://farm9.staticflickr.com/8449/7918424278_4835c85e7a_b.jpg', desc: 'Image 02'},
        {src: 'https://farm9.staticflickr.com/8457/7918424412_bb641455c7_b.jpg', desc: 'Image 03'},
        {src: 'https://farm9.staticflickr.com/8179/7918424842_c79f7e345c_b.jpg', desc: 'Image 04'},
        {src: 'https://farm9.staticflickr.com/8315/7918425138_b739f0df53_b.jpg', desc: 'Image 05'},
        {src: 'https://farm9.staticflickr.com/8461/7918425364_fe6753aa75_b.jpg', desc: 'Image 06'}
    ];
 
    // initial image index
    $scope._Index = 0;
 
    // if a current image is the same as requested image
    $scope.isActive = function (index) {
        return $scope._Index === index;
    };
 
    // show prev image
    $scope.showPrev = function () {
        $scope._Index = ($scope._Index > 0) ? --$scope._Index : $scope.photos.length - 1;
    };
 
    // show next image
    $scope.showNext = function () {
        $scope._Index = ($scope._Index < $scope.photos.length - 1) ? ++$scope._Index : 0;
    };
 
    // show a certain image
    $scope.showPhoto = function (index) {
        $scope._Index = index;
    };
});

If you do not know anything about Angular.js it will probably somewhat confusing when reading the code above, very sorry that I did not have much time to explain to you. If you have any questions, do not hesitate to leave a message in the form of comments, to yourself and others can explain and share knowledge together.

Create Photo Gallery with AngularJS and CSS3

Create Photo Gallery with AngularJS and CSS3 Posted on 05-08-2015  Today I'll show you how to make a photo gallery effect with the help of AngularJS and CSS3. This slideshow was not complex but very easy to apply for the website or web app. Through this article, you will have experience in creating 3D effects with CSS3 and also learn more about using AngularJS, a web app Frameword for the much in vogue today. 1.8/10 818

Comment:

To comment you must be logged in members.

Files with category

  • Instructions for installing and configuring Windows Live Mail on Windows 10 simple

    View: 2535    Download: 0   Comment: 0   Author: none  

    Instructions for installing and configuring Windows Live Mail on Windows 10 simple

    Category: References
    Fields: Other

    0/2 review
    Windows 10 pre-installed Mail application for managing personal email on the device. The latest version of this application but improved a lot and support other email accounts such as Gmail or Yahoo Mail but users almost no "salty" really with this...

  • Step by step instructions to create social networking buttons with CSS3

    View: 1840    Download: 0   Comment: 0   Author: none  

    Step by step instructions to create social networking buttons with CSS3

    Category: References
    Fields: Other

    0.75/6 review
    CSS3 help web designers have the ability to create buttons (buttons) very nice, today I will share with you two tips decoration for button in your web becomes radiant beauty that no need to use photoshop.

  • You should understand the CSS Box Shadow

    View: 1998    Download: 0   Comment: 0   Author: none  

    You should understand the CSS Box Shadow

    Category: References
    Fields: Other

    1.3181818181818/11 review
    Effects his shadow was introduced in the previous article, however, in this article, I will guide more specific about shadow attributes, you try it with anything. First we try to learn css following paragraph:

  • How to do button movement with beautiful CSS3

    View: 1671    Download: 0   Comment: 0   Author: none  

    How to do button movement with beautiful CSS3

    Category: References
    Fields: Other

    0/4 review
    Previously to create motion effects button, you must draw the button in photoshop, then switched to flash to make it possible to move. But now you need not spend too much time doing it, all because of the emergence of CSS3.

  • Create a dropdown menu with CSS3 effects with beautiful transtions

    View: 1962    Download: 0   Comment: 0   Author: none  

    Create a dropdown menu with CSS3 effects with beautiful transtions

    Category: References
    Fields: Other

    0.45/10 review
    More of the dropdown menu you want to introduce to you, this will have the effect menu transitions (converted background of menu background from pale to dark). This menu works well on browsers like FF, Chrome, Safary, but unfortunately did not work...

  • How to hack css for all browsers you should know

    View: 1590    Download: 0   Comment: 0   Author: none  

    How to hack css for all browsers you should know

    Category: References
    Fields: Other

    1.6875/8 review
    In the process of web design, which makes it the most headaches is how to design web pages that you can run on the browser. Especially when clients use the old as IE6 browser such. However, with this article, you will easily edit interface runs well...

  • Create Accordion with extremely beautiful CSS3

    View: 1982    Download: 0   Comment: 0   Author: none  

    Create Accordion with extremely beautiful CSS3

    Category: References
    Fields: Other

    0.9/5 review
    Accordion is a technique that helps you shortened the content that you want displayed on the website. It is often used for the display of submenus. In addition you can also use it for content, images. Before applying this procedure, you have to use...

  • Create the effect Hovercho images with Webkit and CSS3 is great

    View: 1690    Download: 0   Comment: 0   Author: none  

    Create the effect Hovercho images with Webkit and CSS3 is great

    Category: References
    Fields: Other

    1.125/4 review
    WebKit is one open source application framework provides the necessary components built one for your web browser. Along with CSS3, cả have contributed to very nice effect những previously only using JavaScript or JQuery thực beige.​

 
Newsletter Email

File suggestion for you

File top downloads

logo codetitle
Codetitle.com - library source code to share, download the file to the community
Copyright © 2015. All rights reserved. codetitle.com Develope by Vinagon .Ltd