https://codepen.io/rodchsm/pen/POmBje
Does anyone know why I cant get three images across the webpage and the text under the image to center?
props
is data from the parent component, so the component cannot change itstate
is data of the component itself, so the component can change the state by using setState
@rodchsm this css:
.featuredimage {
text-decoration: none;
vertical-align: bottom;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.featuredimage a{
flex-basis: 33%;
text-align: center;
}
.featuredimage a img {
border: 1px solid #000000;
width: 30%;
margin-right: 1%;
clear: right;
border-radius: 5px;
margin-left: 2%;
/* float: left; */
/* display: block; */
}
will help you have them as you want
Hey can someone take a look at this. Trying to figure out why memory
is updating. When I call function 'plus'
memory should update. But then when I don't call function 'plus'
, it still updates. Been stumped on it for a while now. BTW this is a work in progress.
.replace()
with regex. but i am not good with regex
var str = "producer(s)";
str.replace(/(\w+)\((.*)\)/, function(match, p1, p2){
return p1.toUpperCase() + "(" + p2 + ")";
});
"PRODUCER(s)"
var str = "japan producer(s)";
str.replace(/(?<=^|\s)(\w)(\w+)/g, function(match, p1, p2){
return p1.toUpperCase() + p2;
});
"Japan Producer(s)"
var str = "japan producer(s)";
str.split(" ").map(val => val.charAt(0).toUpperCase() + val.slice(1)).join(" ");
"Japan Producer(s)"
.time-with-icon
the width: auto;
instead of 10% and maybe , also add some padding-bottom like 10px
Hi guys, I am finalising my portfolio page and I am facing an issue. When I run it on my local, the responsiveness behaviour looks great, but on codepen, it just doesn't happen (not sure I am on the right channel to ask this).
Background info: I built the page using flexbox. I use a media query for screen under 500px which changes the flex-direction from row to column, collapsing everything in a nice, smart-phone friendly layout .
Expected result: When narrowing the browser window to smartphone size, the menu, my info section, and footer, should be displayed with flex-direction: column and collapse.
Actual result: When opening my page on my local, it works like a charm. However, on codepen, the collapsing doesn't happen.
Please forgive my CSS structure, it's a giant mess :grinning:
https://codepen.io/fpiguet/full/GMbjNv/
Any help would be great!
For JavaScript, what is there to learn?
Arrays, functions, objects, methods?
If, while, for loops? Switch?
What else should I learn?
$headerComponent.delay(300).removeClass("unscrolled");
??unscrolled
is getting removed instantly. var $headerComponent = $(".header-wrapper");
$(window).on("scroll", function(){
var displacementFromTop = window.pageYOffset || document.documentElement.scrollTop;
if (displacementFromTop > 0) {
$headerComponent.delay(300).removeClass("unscrolled");
} else {
$headerComponent.addClass("unscrolled");
}
});
$scope
document.querySelectorAll
should vanish from your javascript
Angular
one means Angular 2/4
. What you are using is AngularJS
Angular
and AngularJS
are 2 totally different
things
.append
html
method outside of the loop
<div class = "col-xs-12 alert message2">
Your country: <span class="country"></span>
</div>
#country { font-weight: bold; }
$("#country").text(json.countries[11]['name']);
setInterval
- or setTimeout
.empty
before the loop and then use .append
@bytao7mao
@alpox yeah then he could just do
$('.message').empty();
$('.message2').empty();
as his first 2 lines in the getJSON callback
for
loop
let hasNotClicked = true;
$('.clickButton').click(function() {
if (hasNotClicked) {
hasNotClicked = false;
// everything else you were doing
}
});
Hey, when I collapse my navbar and click on the "hamburger icon" or icon bars there's no dropdown menu appearing. Any advice?
<div class="container-fluid">
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">BRAND</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav navbar-right">
<li><a href="#">about</a></li>
<li><a href="#">portfolio</a></li>
<li><a href="#">contact</a></li>
</ul>
</div>
</div>
</nav>
</div>
<div>
</div>
Uncaught Error: Bootstrap's JavaScript requires jQuery
.links:hover {
transition: background .3s ease-in-out;
background: rgba(0, 0, 0, 0.8);
}
return options[Math.floor.....9]
function compPicker() {
return options[Math.floor(Math.random() * 9)];
}
@harut-g somewhat
.links
Facility.create(filesJson['facilities'], (err, result) => {
if (err) throw err;
});
People.create(filesJson['people'], (err, result) => {
if (err) throw err;
});
newBook.save().then(() => {
books.find().then(r => {
res.send([r,message]);
facility.create(files.....).then((err,result) => {
stuff
people.create().then( => {
res.send
}
})
thanks @moT01 , I'm trying to see my database, and have two models that I have the seed data for in a JSON file. Both seed scripts are nearly identical. The only difference is the JSON file that gets imported, and the variable name that represents the seed data after import. The first imports fine, and the second files with an error like this:
== 20171030160224-outsider: migrating =======
Seed file failed with error: Cannot read property 'autoIncrement' of undefined TypeError: Cannot read property 'autoIncr
ement' of undefined
at C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\sequelize\lib\dialects\mssql\query-generator.js
:264:48
at C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\lodash\lodash.js:4389:15
at baseForOwn (C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\lodash\lodash.js:2652:24)
at Function.forOwn (C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\lodash\lodash.js:12254:24)
at C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\sequelize\lib\dialects\mssql\query-generator.js
:258:15
at arrayEach (C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\lodash\lodash.js:473:11)
at Function.forEach (C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\lodash\lodash.js:8561:14)
at Object.bulkInsertQuery (C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\sequelize\lib\dialects\
mssql\query-generator.js:248:13)
at QueryInterface.bulkInsert (C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\sequelize\lib\query-
interface.js:568:33)
at Object.up (C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\server\seeders\20171030160224-outsider.js:7:27)
at Migration._callee$ (C:\Users\rutherfordc.AA\AppData\Roaming\npm\node_modules\sequelize-cli\node_modules\umzug\lib
\migration.js:178:35)
at tryCatch (C:\Users\rutherfordc.AA\AppData\Roaming\npm\node_modules\sequelize-cli\node_modules\regenerator-runtime
\runtime.js:65:40)
at Generator.invoke [as _invoke] (C:\Users\rutherfordc.AA\AppData\Roaming\npm\node_modules\sequelize-cli\node_module
s\regenerator-runtime\runtime.js:299:22)
at Generator.prototype.(anonymous function) [as next] (C:\Users\rutherfordc.AA\AppData\Roaming\npm\node_modules\sequ
elize-cli\node_modules\regenerator-runtime\runtime.js:117:21)
at step (C:\Users\rutherfordc.AA\AppData\Roaming\npm\node_modules\sequelize-cli\node_modules\babel-runtime\helpers\a
syncToGenerator.js:17:30)
at C:\Users\rutherfordc.AA\AppData\Roaming\npm\node_modules\sequelize-cli\node_modules\babel-runtime\helpers\asyncTo
Generator.js:28:13
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
The seed script is as follows:
'use strict';
const cjson = require('cjson');
var outsiderData = cjson.load('server/seeders/Outsider.json');
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.bulkInsert('Outsiders', outsiderData);
},
down: (queryInterface, Sequelize) => {
return queryInterface.bulkDelete('Outsiders', null, {});
}
};
Yes, the code for the Auto Increment is here:
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('Outsiders', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
firstName: {
type: Sequelize.STRING,
allowNull: false
},........
this is supposed to handle the auto increment of table keys on it's own, but I guess it's borked.
var ourRequest = new XMLHttpRequest();
ourRequest.open('GET', "https://www.erepublik.com/en/military/campaigns-new");
ourRequest.onload = function() {
var x = Object.values(JSON.parse(ourRequest.responseText).battles);
var c = Object.values(JSON.parse(ourRequest.responseText).countries);
var c2 = Object.keys(JSON.parse(ourRequest.responseText).countries);
for (var i = 0; i < 2 ; i++) {
if (x[i].inv.points > x[i].def.points) {
console.log( "winnerID: " + x[i].inv.id +"Country Winner is: " + c[i]['name'] + " Country KEY id is: " + c[i]['id'] + " Loser ID is: " + x[i].def.id);
} else if (x[i].inv.points === x[i].def.points) {
console.log(" EQUAL" );
} else {
console.log("DEF WINS");
}
};
};
ourRequest.send();
winnerID: 79Country Winner is: Romania Country KEY id is: 1 Loser ID is: 167
&& c[i]['id'] == x[i].inv.points
if i nest this in the if statement it only returns "DEF WINS"