Slider for stackoverflow

Developer
Size
3,222 Kb
Views
24,288

How do I make an slider for stackoverflow?

What is a slider for stackoverflow? How do you make a slider for stackoverflow? This script and codes were developed by Koku on 06 November 2022, Sunday.

Slider for stackoverflow Previews

Slider for stackoverflow - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>slider for stackoverflow</title>
</head>
<body> <div id='app'>
</div> <script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react-dom.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Slider for stackoverflow - 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; }
// the recettesImages are the exact name of the images in my img folder
var recettesImages = ["boeuf_saute.jpg", "poelee_de_veau_aux_carottes_et_oignons.jpg", "poelee_gambas.jpg", "salade_de_fruits_de_saison.jpg"];
// this is the img path in my repo
var imagesPath = "./app/img/recipes/";
var RecetteSlider = function (_React$Component) { _inherits(RecetteSlider, _React$Component); function RecetteSlider(props) { _classCallCheck(this, RecetteSlider); var _this = _possibleConstructorReturn(this, _React$Component.call(this, props)); _this.state = { url: imagesPath + 'poelee-gambas.jpg', index: 0, recettesNumber: recettesImages.length }; _this.urlChange = _this.urlChange.bind(_this); return _this; } RecetteSlider.prototype.urlChange = function urlChange() { this.setState(function (prevState) { if (prevState.index < this.state.recettesNumber - 1) { return { index: prevState.index + 1, url: imagesPath + recettesImages[prevState.index + 1] }; } else { return { index: 0, url: imagesPath + recettesImages[0] }; } }); }; RecetteSlider.prototype.componentDidMount = function componentDidMount() { this.timer = setInterval(this.urlChange, 5000); }; RecetteSlider.prototype.componentWillUnmount = function componentWillUnmount() { clearInterval(this.timer); }; RecetteSlider.prototype.render = function render() { return React.createElement( "div", { className: "recetteSlider" }, React.createElement("img", { src: this.state.url, alt: "image unavailable" }), React.createElement( "div", { className: "text-wrapper" }, React.createElement( "div", { className: "text" }, React.createElement( "p", null, "Wellcome on the largest elsewhere cooking amateurs community", React.createElement("br", null), "Discover delights around the world and share yours" ) ) ) ); }; return RecetteSlider;
}(React.Component);
;
Slider for stackoverflow - Script Codes
Slider for stackoverflow - Script Codes
Home Page Home
Developer Koku
Username KKOKU
Uploaded November 06, 2022
Rating 3
Size 3,222 Kb
Views 24,288
Do you need developer help for Slider for stackoverflow?

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!

Koku (KKOKU) Script Codes
Create amazing sales emails with AI!

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!