benjmhart sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
:cookie: 207 | @piteto |http://www.freecodecamp.com/piteto
users.forEach(e => {
Promise.resolve(e)
.then(getChannelData)
.then(getStreamsData)
.then(renderUser)
.catch(doSomething);
});
@Benjmhart
benjmhart sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
:cookie: 587 | @korzo |http://www.freecodecamp.com/korzo
I'm also good with css, but I have zero design imagination. If I see something, I can code it, but I can't create something to display by myself
well i'm not THAT bad at css, but i'm not really good either, i can copy basic stuff, my worst nemesis in design is choosing colors
footer {
width:100%;
bottom:0;
left:0;
position:absolute;
}
footer {
width:100%;
bottom:0;
left:0;
position:absolute;
}
html, body {
height: 100%;
}
body {
display: flex;
flex-direction: column;
}
and add flex: 1 0 auto; to content
gh05d sends brownie points to @hashtagyolo1 :sparkles: :thumbsup: :sparkles:
:cookie: 277 | @hashtagyolo1 |http://www.freecodecamp.com/hashtagyolo1
function whatIsInAName(collection, source) {
// What's in a name?
var arr = [];
// Only change code below this line
for (var i in collection) {
for (var j in collection[i]) {
if (collection[i][j] === source[j]) {
arr += collection[i];
}
}
}
// Only change code above this line
return arr;
}
whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" });
arr.push(collection[i]);
+=
.
hashtagyolo1 sends brownie points to @masd925 and @gh05d :sparkles: :thumbsup: :sparkles:
:cookie: 290 | @gh05d |http://www.freecodecamp.com/gh05d
:star2: 4525 | @masd925 |http://www.freecodecamp.com/masd925
for...in
loop is not guaranteed to loop property keys in insertion order. Therefore a for...in loop is not good if array element iteration order matters. Not totally sure if it matters here, but generally you should use a simple for loop or array iterators to loop array indices.
container div
and my center-element div
extends passed its circle as well
center-element
sticks out into each of them (only slightly) and the "empty" corners are still clickable
rscales02 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4526 | @masd925 |http://www.freecodecamp.com/masd925
alteducation sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:star2: 1343 | @alpox |http://www.freecodecamp.com/alpox
} for(var i=0;i<modalBtn.length;i++){
modalBtn[i].addEventListener('click',openModal);
}
@alpox
var modalBtn = document.getElementsByClassName("modal-show");
function openModal (){
modal.style.display = "block";
document.body.style.height ="100vh";
$('.modal').scrollTop(0);
}
for(var i=0;i<modalBtn.length;i++){
modalBtn[i].addEventListener('click',openModal);
}
@CXmanager use this code
`
display:flex;
}
width:95%;
padding: 0 3%;
}
`
modal.style.display =" block"
;?
this.style.display...
this
instead of modal
?
@alpox
var modal = document.querySelectorAll('.modal');
var modalBtn = document.getElementsByClassName("modal-show");
function openModal (){
for(var i=0;i<modal.length;i++){
for(var j=0;j<modalBtn.length;j++){
if(modal[i] === modalBtn[j]{
modal[i].style.display = "block";
});}}
}
Can I do something like this
data-target
html attributes on the buttons which hold a selector uniquely identifying the modal it should open (the modal also needs a unique id then). Then you can just ask for the attribute in openModal
and use the selector for getting the right modal.
modalBtnArr.indexOf(this);
to retrieve the index of the button in the buttonlist and then use the index to read out the modal with the same index out of a list retrieved through another getElementsByClassName to the modals. This is a less secure method though and is more error prone
var display = 0554651;
$("#equals").on("click",function(){
$("#display").html(display);
});
0
display = "0554651";
$("#display").html(display.toString());
gh05d sends brownie points to @alteducation :sparkles: :thumbsup: :sparkles:
@Gh05d flexbox makes layouts super easy. If you are unfamiliar with flexbox please try games such as flexboxfroggy, flexboxdefence etc they will help you understand flexbox.
what i did is i applied the property display: flex that makes the element a flexbox element
the align-items:center centers it vertically inside the element
and justify-content:center centers it horizondally
both of them are flexbox properties
gh05d sends brownie points to @alteducation :sparkles: :thumbsup: :sparkles:
success: function(data){
if (data.message == 'success') {
location.reload();
$(window).on('load', function(){
showNotification('alert-success', '@lang("tables.success")', 'top', 'right', 'animated fadeIn', 'animated fadeOut');
});
}
else if (data.message == 'nosuccess'){
showNotification('alert-danger','@lang("tables.fail")' , 'top', 'right', 'animated fadeIn', 'animated fadeOut');
}
}
$(window).on("load", function() {
showNotification("alert-success", '@lang("tables.success")', "top", "right", "animated fadeIn", "animated fadeOut");
});
...
success: function(data){
// ajax success function code here
}
$().addClass()
function never takes effect. $('.xlsFile').click(() => {
console.log('file clicked');
console.log($(this).hasClass('selected'));
if($(this).hasClass('selected')){
console.log('Selected is True')
$(this).removeClass('selected');
}else{
console.log('Selected is false')
$(this).addClass('selected');
}
});
this
keyword won't work with arrow functions =>
cjrutherford sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
:cookie: 210 | @piteto |http://www.freecodecamp.com/piteto
this
with '.xlsFile'
$(".xlsFile").click(function() {
$(this).toggleClass("selected");
});
$(".xlsFile").click((e) => $(e.currentTarget).toggleClass("selected"));
element.scrolleft
and element.scrollWidth
to determine the beginning and end scroll position
selnapenek sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
:cookie: 211 | @piteto |http://www.freecodecamp.com/piteto
@alpox i'm trrying to grab the data element of the button clicked
here is what i wrote
for(var i=0;i<modalBtn.length;i++){
modalBtn[i].addEventListener('click',function(e){
const openModal = document.querySelector(button[data-modal="${e.data('modal')}]"
);
console.log(openModal);
});
which is wrong
could you please help
${e.data('modal')}
? @alteducatione.data
are... i would console.log(e)
console.dir(e)
OR console.dir(e.target)
data
property
alteducation sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 3652 | @moigithub |http://www.freecodecamp.com/moigithub
hi could some one help me with this javascript syntax
var modal = document.querySelectorAll('.modal');
var currentModalValue;
var modalBtn = document.getElementsByClassName("modal-show");
var closeBtn = document.querySelector('.close-post');
function openModal(){
modal[currentModalValue].style.display = "block";
document.body.style.height ="100vh";
$('.modal').scrollTop(0);
}
function closeModal(){
modal[currentModalValue].style.display = "none";
}
for(var i=0;i<modalBtn.length;i++){
modalBtn[i].addEventListener('click', function(e){
currentModalValue = e.target.dataset.modal;
});
}
Please tell me how to pass the openModal function along with modalBtn[i].addEventListener() so that it runs when the button is pressed. Is this the right way to do it?
for(var i=0;i<modalBtn.length;i++){
modalBtn[i].addEventListener('click', function(e){
currentModalValue = e.target.dataset.modal;
openModal();
});
this fixed the issue but i am unable to close the modal now
var closeBtn = document.querySelector('.close-post');
selects only first close button
for(var i=0;i<closeBtn.length;i++){
closeBtn[i].addEventListener('click',closeModal);
}
this worked
modal[currentModalValue].focus()
if this is current modal element
function openModal(){
modal[currentModalValue].style.display = "block";
modal[currentModalValue].focus();
document.body.style.height ="100vh";
$('.modal').scrollTop(0);
}