Posts

Showing posts from 2020

Creating a Carousel with JS, HTML, CSS Part 2

Image
JavaScript Experiment: Carousel images Part 2 The Set-up: Part 1 Lets make some changes.  How it looks after the initial set-up: DESIGN: There are a few design changes I'd like to make before I put in the images, and I'll do that now.  The main reason is I want the left and right image containers to be skewed and smaller than the main image. When the images change, it should feel like they are moving.  I'll add that styling now, so if there are any problems with how the images appear when they are assigned a new div, I'll know before going to deep in the code. I'm going to run the HTML file in the browser, and inspect it with the web dev tools. There I can click on an element and change its properties and see the results in live time.  This is part of why setting up that CSS file is helpful.   The web dev tools will pick up the related CSS class's and ID's and I can manipulate them directly.  Once I have it looking how I want, I can copy and paste what I hav

Creating a JavaScript HTML and CSS Image Carousel

JavaScript Experiment: Carousel images  Part 1 SET UP: The first thing I am going to do is set up my HTML file, and the CSS that will control the design.  In the head of the html I will include the meta information that will help describe the purpose, and content of the page. The viewport is important not only for mobile design, but accessibility.  We want users to be able to scale the page to at least 5 times it's initial size.  This way if they need to enlarge font and content to see it, they can.  In the body, we'll define the objects/tags we want to be able to manipulate in both the CSS and in the javascript. The easiest and fastest way to change items in the HTML with JavaScript is with the unique id applied to the item.  The DOM can find these, and apply the code to them without much hassle.  For items I will be manipulating in the JavaScript, I add an id, with a snake case.  JavaScript can get fussy about hash marks.  For classes, or CSS only changes I will use class and

Animation with JavaScript

An Animation Experiment JavaScript is still a bit new to me, and I have yet to dive into the <canvas>.  I wanted to explore animation on web pages with vanilla Javascript. This seemed like a great opportunity to experiment, and share it for others to use. If you haven't seen some of my older posts, I do have experience with python GUI libraries like tkinter and pygame, so I had some basic knowledge on my hands before playing with this code. If you'd rather just dive in with your web dev tools or fork the github repo and play, here are the links: webpage: https://nelliesnoodles.github.io/JS_Animation/ repo:  https://github.com/nelliesnoodles/JS_Animation Breakdown of the JavaScript When I write my javascript, I organize it the same way I would a python file. At the top most are the functions called and used by the functions below them. At the bottom of the file will be the functions that get everything moving. If a function doesn't require