Connect 4 Javascript Game - Push to lowest circle in column [closed] - javascript

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
Ive got this Connect4 game : http://codepen.io/anon/pen/lmFJf
What I'd like to do is when I click on any free space/circle in a column, it adds it to the lowest circle/point in the column (just like standard Connect 4 / 4-in-a-row) however I'm having trouble doing this.
I'm not sure if my current setup will allow me to easily do this though...
Thoughts?

Your click events are tied to the cells. Shouldn't they be tied to the columns instead? Since you can't actually place a piece in a cell that would have an empty space below it.
I think this will greatly simplify your setup.
Each column keeps a record of which pieces it has, like: RYREEE (red yellow empty).
Also, keep your model in JavaScript. Don't read from the DOM. The DOM should be a view only.

Related

form is not working, I used HTML5 & bootstrap 3.0? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
form is not working, I used HTML5 & bootstrap 3.0?
here i add the link of the site please checkout.
I cant figure-out it.
http://www.deliveryguys.in/html/index.html
It's usually best to post snippits of code that you think are malfunctioning but in this case I think you should invest in a spellchecker.
I went to
http://www.deliveryguys.in/html/index.html
And it seems to work fine.
Notice it's HTML instead of HMTL
Edit: OK now I see the real problem with your code
The form is underneath other HTML elements. You need to give your stylings z-indexes in order to control what is on top of what. I gave the form a z-index of 1000 and it worked fine. I suggest editing your css classes to include z-indexes to give you finer control than that.
Please note that your form action has been mapped to "#"
Kindly point the form action to the appropriate server page & it will start working.
Regards
SRIRAM NATARAJAN
(Chennai, Tamil Nadu, India)
(www.thesriram.co.in)

What do you call this bug and is it a CSS, JS, library bug? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I have this bug happening in my site where my menu drops down and instead of being render on top there is this one area that is under the table.
I am looking for an answer but am not sure exactly what is the bug called, or if it is a CSS, java script, or library problem. The menu is created using Kendo Ui and the table/Grid is created using JqxGrid. If you guys can help me identify the name of this behavior it will help me a lot in finding the solution. Or if you know the reason that is even better. Before I show code I would like to try to solve this on my own. Thank you.
It looks to me like an issue with your CSS. The row of the grid you have is at a higher z-index than your menu. In my experience the best thing to do is to explicitly (where possible) give your menu items z-indices higher than anything else you have on the page (or would want). eg. if your highest z-index is 100, use 1000 for the menu.

Comodo TrustLogo Wiping Out JS based pages [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
So I'm guessing this happens with.. many.. somewhat old-tech things like this, but I have a javascript only website based on backbone, and have shopping pages I'd like to get some validated badges on, case in point: [A Comodo Trustlogo][1]
Basically, when I follow the instructions, it completely wipes out the page, replacing the entire body with a white page and the logo itself, instead of kindly inserting itself into a div or whatnot.
Anyone have an idea on how to get it to inline properly?
This is to do with where you have placed your Comodo code. Where you've placed it, both document.write and document.writeln will destroy the page.
Move it to the top of the <body> element or whereever in the <body> element (not outside, not in <head>, not directly in <html> nor on the outside) you prefer.

jquery click function in for loop only working in last loop [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Improve this question
I'm probably doing something obviously wrong, but I just can't see it. I'm trying to use a for loop to define multiple click events and am experiencing an unexpected result. Some of this is working (the hide and show at the beginning of the function, but both sections wind up targeting the second item in the loop. Could somebody take a look at this and tell me what I'm doing wrong? Thank you so much for your help!
here is the link:
http://grana.us/test/expand2.html
You are assigning same event to all summaries for every id. This is wrong...
First... to hide all details and show all toglers simply use:
$('.details').hide();
$('.toggler').show();
And then define click function to all sumaries:
$('.summary').click(function(){
if($('.toggler',this).html() == ' -'){
$('.toggler',this).html(' +');
$('.details',$(this).parent()).hide();
}else{
$('.toggler',this).html(' -');
$('.details',$(this).parent()).show();
}
});
Put everything in...
$(function(){
...
});
and should be ok.

Change the text in the header of the page when scrolling down [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I want to change the text in the header of my page (the header sticks to the top) when scrolling down that page.
Each time you pass the bottom of the current div, the text in the header changes again.
This is a prefect example of what I want: prss.com.
I'm pretty bad with javascript and jQuery, so if annybody has a solution...
Thanks in advance,
Jasper
You can simply use the .scroll() event of the jQuery to detect the user scroll and then do whatever you want based on the scroll position. The latter one you can get using the .scrollTop() function of jQuery.
Here is the JSFiddle, which demonstrates the functionality similar to the one you've provided.

Categories