Test Photo Gallery
How do I make an test photo gallery?
Make a photo Gallery. What is a test photo gallery? How do you make a test photo gallery? This script and codes were developed by Feng on 07 January 2023, Saturday.
Test Photo Gallery - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Test Photo Gallery</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id='gallery'></div> <script src='https://npmcdn.com/[email protected]/dist/react.min.js'></script>
<script src='https://npmcdn.com/[email protected]/dist/react-dom.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js'></script>
<script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js'></script>
<script src='https://code.jquery.com/jquery-2.2.4.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Test Photo Gallery - Script Codes CSS Codes
.photoGallery { width: 70%; display: flex; flex-wrap: wrap; justify-content: center;
}
.photo { width: 300px; /* you can use % */ height: auto; margin: 10px;
}
.modal { display: none; /* Hidden by default */ position: fixed; /* Stay in place */ z-index: 1; /* Sit on top */ padding-top: 100px; /* Location of the box */ left: 0; top: 0; width: 100%; /* Full width */ height: 100%; /* Full height */ overflow: auto; /* Enable scroll if needed */ background-color: rgb(0,0,0); /* Fallback color */ background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
}
.modal-content { margin: auto; display: block; width: 80%; max-width: 700px;
}
@media only screen and (max-width: 700px){ .modal-content { width: 100%; }
}
Test Photo Gallery - Script Codes JS Codes
'use strict';
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var PhotoGallery = function (_React$Component) { _inherits(PhotoGallery, _React$Component); function PhotoGallery(props) { _classCallCheck(this, PhotoGallery); var _this = _possibleConstructorReturn(this, _React$Component.call(this, props)); // You do super props if you want this.props in constructor _this.state = { photos: props.photos, currentPhoto: "https://41.media.tumblr.com/0390d80d6c8cc4a7096033182a4bfe8a/tumblr_ndyvukSjNl1tubinno1_1280.jpg" }; _this.photoClicked = _this.photoClicked.bind(_this); _this.closeModal = _this.closeModal.bind(_this); return _this; } PhotoGallery.prototype.componentDidMount = function componentDidMount() { var _this2 = this; // Get Request not yet working $.get('https://api.nasa.gov/mars-photos/api/v1/rovers/curiosity/photos?sol=1000&api_key=DEMO_KEY', function (response) { console.log('I got response'); }).fail(function (error) { console.log('We failed', error); }); var updatePhotos = function updatePhotos(data) { _this2.setState({ photos: data.photos }); }; }; PhotoGallery.prototype.photoClicked = function photoClicked(event) { this.setState({ currentPhoto: event.target.getAttribute('href') }); document.getElementById('modal').style.display = 'block'; return; }; PhotoGallery.prototype.closeModal = function closeModal(event) { document.getElementById('modal').style.display = 'none'; return; }; PhotoGallery.prototype.render = function render() { var _this3 = this; return React.createElement( 'div', { className: 'photoGallery' }, React.createElement(PhotoModal, { photo: this.state.currentPhoto, closeModal: this.closeModal }), this.state.photos.map(function (photo) { return React.createElement(Photo, { photo: photo, photoClicked: _this3.photoClicked }); }) ); }; return PhotoGallery;
}(React.Component);
;
var Photo = function Photo(props) { return React.createElement( 'div', { className: 'photoContainer' }, React.createElement('img', { className: 'photo', onClick: props.photoClicked, src: props.photo, href: props.photo }) );
};
var PhotoModal = function PhotoModal(props) { return React.createElement( 'div', { className: 'modal', id: 'modal', onClick: props.closeModal }, React.createElement('img', { className: 'modal-content', src: props.photo, onClick: props.closeModal }) );
};
// Image Size: 1280 x 853
var photoUrls = ["https://41.media.tumblr.com/0390d80d6c8cc4a7096033182a4bfe8a/tumblr_ndyvukSjNl1tubinno1_1280.jpg", "https://40.media.tumblr.com/bbe414414f4fd1f0b4886c6fcf4193de/tumblr_ndyvd3qoiL1tubinno1_1280.jpg", "https://41.media.tumblr.com/3dde93f097de5e9db4f11b67729d6a2e/tumblr_na06dk1vWM1tubinno1_1280.jpg", "https://40.media.tumblr.com/e67b59d43c79c496b6fa8f1dddabef47/tumblr_nbc7zx6vJl1tubinno1_1280.jpg", "https://40.media.tumblr.com/d94d2a63ab509f403111c6e8ebfc22a4/tumblr_ndyfu61hzH1tubinno1_1280.jpg", "https://40.media.tumblr.com/d7a014af6eaec53ccdc7a4171033f96d/tumblr_na06t4fnlI1tubinno1_1280.jpg", "https://40.media.tumblr.com/7302cf024c924726c6ad99bb80b0be41/tumblr_nauccbKUCw1tubinno1_1280.jpg", "https://41.media.tumblr.com/fddb3f2b0bdf390efd7ea87372e75fa5/tumblr_ndyg3pYbKW1tubinno1_1280.jpg", "https://41.media.tumblr.com/758a5cb9046fde53138ad0f55527ca25/tumblr_ndyfdoR6Wp1tubinno1_1280.jpg"];
ReactDOM.render(React.createElement(PhotoGallery, { photos: photoUrls }), document.getElementById('gallery'));
Developer | Feng |
Username | felixfeng |
Uploaded | January 07, 2023 |
Rating | 3 |
Size | 4,801 Kb |
Views | 4,048 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Test Pen | 1,240 Kb |
Test Redux Counter | 5,053 Kb |
Test - ScrollSpy | 3,092 Kb |
Practice - Connect 4 | 3,976 Kb |
A Pen by Feng | 1,151 Kb |
Lights Out Game | 3,419 Kb |
Test Slides | 3,617 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Button fills | Zubfatal | 5,205 Kb |
CSS 3D Radio buttons | Andreasnylin | 1,650 Kb |
Ball bouncing loading animation | Adam2326 | 3,144 Kb |
Gulpfile | Aimhigherwebdesign-amy | 1,765 Kb |
Box-sizing | Elad2412 | 1,572 Kb |
Layout 11 | Altynai | 1,690 Kb |
Wave Lines | Mikehobizal | 4,023 Kb |
Feedback Page | TessDiNapoli | 2,836 Kb |
CSS Infinite 360 | APinix | 5,564 Kb |
Button shaking | SusanneLundblad | 2,227 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!