var where = document.createElement(div);
function myFunction() {
for(var i=0; i<=9999; i++){
var p = document.createElement("p");
var b = i/10000;
b=b.toFixed(4)
p.innerText = setDecimal(b);
where.appendChild(p);
}
function setDecimal(num) {
var str = "" + num;
var zeroPos = str.indexOf(".")+1;
if (zeroPos == -1) return 0;
str = str.slice(zeroPos);
return str;
}
let curr = this.route.scrollLeft;
var requestId = 0;
let now = window.performance.now();
function quad(progress) {
return Math.pow(progress, 2)
}
let animate = (time) => {
var progress = (time - now) / 200;
console.log(progress, time - now );
if(progress>1){
progress = 1
}
if(this.startx > this.endx){//to right
this.route.scrollLeft = curr + (this.list.children[0].offsetWidth*progress);
}
if(this.startx < this.endx){//to left
this.route.scrollLeft = curr - (this.list.children[0].offsetWidth*progress);
}
if(progress == 1){
stop()
return
}
requestId = window.requestAnimationFrame(animate);
}
function start() {
let animationStartTime = window.performance.now();
requestId = window.requestAnimationFrame(animate);
}
function stop() {
if (requestId)
window.cancelAnimationFrame(requestId);
requestId = 0;
}
if(Math.abs(this.endx - this.startx) > 10 ){
start();
}
onClick = (e) =>{
e.target.value < это ваше значение, item.code
тут вызываете открытие вашего модального окна, через state или напрямую по рефс и кладете сюда
если рефс то примерно так
this.refs. имя рефс. имя функции в компоненте модал(или можно прямо setState({code: e.target.value})
}
выше функция которая вне рендер
<button data-toggle="modal"
data-target="#CardModal"
onClick={this.onClick} <<<<<<<
type="button"
value = {item.code}<<<<<<<<<<<
className="fa fa-eye"
aria-hidden="true"
title="Просмотр"></button>
сonstructor(props) {
super(props);
this.state = {
eventFilterParking: '',
eventFilterFuel: '',
eventFilterFuel_Drain: '',
eventFilterSpeed: '',
eventFilterVoltage: '',
eventFilterTerm: '',
}
}
const webpack = require('webpack')
const path = require('path')
const merge = require('webpack-merge')
module.exports = merge(require('./webpack.config'), {
devtool: 'source-map',
devServer: {
compress: false,
host: ''192.168.01.01',',//your ip adress"
port: 9000,
contentBase: path.resolve(__dirname, '../src')
}
})
var lang = {
en: {
word: "word"
},
ru: {
word: "слово"
}
fr: {
word: "la word"
}
var choosed = 'ru';
//по клику меняешь значение
$("select").on('change', function () {
choosed = $("select option:selected").val();
}
//функция возвращает слово
function ChoosedLanguge(lang,choosed, word ){
return lang[choosed][word]
}
// контент будет выглядеть так
<div id="fr" class="page">
ChoosedLanguge(lang,choosed, word )
</div>
<div id="en" class="page">
ChoosedLanguge(lang,choosed, word )
</div>
<div id="sp" class="page">
ChoosedLanguge(lang,choosed, word )
</div>
handleClick() {
if (!this.state.active) {
// attach/remove event handler
document.addEventListener('click', this.handleOutsideClick, false);
} else {
document.removeEventListener('click', this.handleOutsideClick, false);
}
this.setState(prevState => ({
active: !prevState.active,
}));
}
handleOutsideClick(e) {
// ignore clicks on the component itself
console.log('EVENT handleOutsideClick ', e)
if (this.node.contains(e.target)) {
return;
}
this.handleClick();
}
ref={node => { this.node = node; }}
<li className='notif_container' ref={node => { this.node = node; }}>
{this.button()}
</li>