Multiple buttons function to expand and hide div section with javascript - javascript

Hope everyone is having fun on this fun (or frustrating šŸ˜‚ like me) coding day. So, I came across a problem and was hoping someone could help guide me to the right solution. I want to set it so that when I click on the ā€œread moreā€ button, it adds the ā€œactiveā€ class and would expand the paragraphs.
I was able to do a loop function for multiple buttons on the page, but when I click on one, it affects all the buttons. I know this is a looping problem but I have not figured out a way to solve it.
What Iā€™m trying to do is basically only have the button I click on add the class, without it working on all the buttons on the webpage. I intend to add more buttons to the page, so if anyone has a better solution or knows of a looping method (cause Iā€™m pretty sure the looping Iā€™m using is the wrong way), please help.
Please see the video for what I mean when I click on one button, both buttons get affected by it.

Related

can't properly implement a MODAL (beginner)

Ive been stuck on this for a while now.
I have an API of a LIST that I want to display, each one of the objects on the list needs to be cliackable and a MODAL should appear with the LIST OBJECTS info ''pokemon height'', 'pokemon name'' and ''pokemon type''. The MODAL should also be CLOSED when clicking ESC or outside of the MODAL.
The thing is, I believe I added all the codes correctly but everytime I find an error, or the list simply disappears. I fix an error and another one appears, when there is no errors it simply just doesn't work. I am sorry if that is a rather simple thing to do but I am brand-new to programming and I am trying to learn.
It just seems that everytime I ''correct'' something, I get further away from the correct way of doing it. PLEASE if somebody could take a look in what I've done and give me some tips or point what should be done here. THANKS
HERE IS THE LINK TO MY "PROJECT":
added functions to loadDetails, loadList, addListItem (it worked)
then by adding the MODAl, CLOSE MODAL, HIDE MODAL, it just doesnt answer accordingly

Creating a modal previous and next interaction for images

I am having trouble adding a functioning previous and next button to my modal windows to allow users to navigate through my images without clicking the X and finding the next image. Here is my website link to see and how everything is set out. http://monospaced.co.uk/
I have been struggling for months, my last test I managed to get the previous and next buttons, but they were sitting on the main page when i need them inside of the modal window for each image, and it wouldn't switch. Thanks, for taking the time to help. (if anyone does!)
I am a designer so while it's probably simple to create a previous and next button for your images inside a modal window, I am not sure how to do it without starting from scratch as I wouldn't understand what to change in my code without breaking the website.
Sorry I couldn't get the code into the question. I would really appreciate help, but I understand If it's too much effort because my question is trash...

Button OnCreate asset/resource at a different activity

Hello I have asked this question before but perhaps it wasn't clear or was deemed irrelevant but I need to figure out how to make a button OnClick create a button on another XML layout.
I am very new to java and coding in general and have looked for the past few days but can not find any information on how I would go about this.
The closest I could get was another users question on stackoverflow where the method of keeping the button I want to create invisible and having it switch visibility OnClick of original button, but this isn't feasible.
While this method would work for the single button I need to click to generate the other button, the place it would generate it will also generate a different variety of buttons from other sources. The only way this seems possible is to have the dozens of invisible buttons from each source already stored there and that doesn't seem like the most logical way to approach it code wise.
I would greatly appreciate any help in this area, I'm not expecting anyone to show me how it's done or write me sample code if you could simply nudge me in the direction of an online guide,tutorial or information source I'd be very grateful,
Thanks for your patience.
Creating Button programmatically and adding to the LinearLayout.
//First get the reference of LinearLayout where you need to add the buttons.
LinearLayout ll=(LinearLayout)findViewbyId(R.id.llayout);
// Layout Param
LayoutParams param = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
/* This line of code to add the button in layout (implement your own logic i.e how many time you need to add the button and at which condition you need to add).*/
Button button = new Button(Context);
button.setText("dynamic button 1");
ll.addView(button,param);
Hope this achieve your goal.

Bookmarklet to select all friends and add them to an event on Facebook

I am trying to make a bookmarklet to allow me to select all my friends in the dialog to create an event on Facebook. Examining the source with Firebug shows the following:
The div container for each person gets a new class label of
selectedCheckable
when it it is clicked, So I have written this like of JS to try and select all the div's and give them this class:
$(".checkableListItem").addClass("selectedCheckable");
This works in selecting them, however when it comes time to press the "Save and close" button, the changes do not seem to have any effect in selecting all the friends to add to the event. It seems that FB has a different way of marking the friends that have been selected to add to the event. Would anyone be able to point me in the right direction so I can accomplish this? Thanks in advance, RayQuang :)
May I advise instead of making your own couldn't you just use one of these Greasmonkey scripts?
http://userscripts.org/scripts/search?q=facebook+invite&submit=
That's what I was doing and it was working for my events. Let me know if it works for you.

Hover over something for information to appear in another

I have been trying to find ways to to hover over something so that more information will appear in a different section. I have been looking at similar questions that were posted but I am still not sure how to do it.
I want "Recently on Sale" to show up first, then as I hover over the others, more information will appear for them respectively. Here is the link to what I have been working on: http://jsfiddle.net/saikirakiva/jVaLd/
I have been using just css, is javascript more suitable for what I am trying to do?
Thank you!
JavaScript is useful because it allows you to delay hiding the second element when the mouse moves away from the first element. This feature is especially important in nested drop down menus, because users frequently leave a menu item for a short time while navigating to its submenu.
you can do it like this: http://jsfiddle.net/mnbayazit/Vhg6p/9/

Categories