Incorporating ratings and heart icons next to every movie title

I am tasked with creating a simple Movie listing website where users can add or remove movies from their favorites list. Instead of a standard add to favorites button, I would like to use the heart icon from Bootstrap. Additionally, I want to display the rating of each film using star icons next to the film names.

// DUMMY names
var names = {
    1: {
        name: "Red Notice",
        desc: "An Interpol agent tracks the world's most wanted art thief.",
        img: "rn.jpg",
    }, 
    // Add more movie objects here
};

// JavaScript object to handle movie operations
var movie = {
    // Code for saving, loading, and managing favorite movies

    // Initialization function
    init: function() {
        // Code to initialize the movie website
    },

    // Function to add a movie to favorites
    add: function() {
        // Code to add a movie to favorites
    },

    // Function to remove a movie from favorites
    remove: function() {
        // Code to remove a movie from favorites
    },

    // Add more functions as needed

};
// Call the init function when the page loads
window.addEventListener("DOMContentLoaded", movie.init);
/* CSS code for styling the movie listing website */
<!DOCTYPE html>
<html>

<head>
    <title>MOVIE LISTING WEBSITE</title>
    
    <link rel="stylesheet" href="style.css">
    <script src="script.js"></script>
</head>

<body>
    <h1 class="title">Movie Listing App</h1>
    <div id="movie-wrap">
        <div class="name">
            <h2>Movie Names</h2>
            <div id="movie-names">

            </div>
        </div>
        <div class="name">
            <h2>Favorites</h2>
            <div id="movie-items">
            </div>
        </div>

    </div>
</body>

</html>

If there are any simpler methods to achieve the same functionality for this website, I would appreciate any guidance or suggestions. Thank you!

Answer №1

For reference, visit:

To begin, import Bootstrap into the header of your HTML page:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="791b16160d0a0d0b1809394c5749574b">[email protected]</a>/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fd9f9292898e898f9c8dd0949e92938ebdccd3c8d3cd">[email protected]</a>/font/bootstrap-icons.css">

Afterwards, you can incorporate icons like this:

<span class="bi-star"></span> 

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Error message: The function for the AJAX call is not defined

I'm currently working with jQuery's ajax function and encountering an error: 'getQty is not defined' Can you spot my mistake here? jQuery Code: function getQty() { var dataString = "itemId=" +$(".itemId").val(); $.ajax({ t ...

Discovering the process of iterating through values from multiple arrays of objects and applying them to a new response in Angular 8

Received the following data from an API response: const apiResponse = { "factoryId": "A_0421", "loss": [ { "lossType": "Planned Stoppage Time", "duration": ...

Inspect the properties of a ReactJS component using Playwright

I'm relatively new to end-to-end (E2E) testing. One area I am looking to test involves changing the shipping address and automatically setting it as the billing address. For example, if I input Grove Street as my shipping address, I want it to mirror ...

The function is unable to accurately retrieve the state value

In my app, I have a component where I'm attempting to incorporate infinite scroll functionality based on a tutorial found here. export const MainJobs = () => { const [items, setItems] = useState([]); const [ind, setInd] = useState(1); const ...

Setting new query parameters while maintaining existing ones without deleting them in Next.js v13

"use client"; import { useCallback, useEffect, useState } from "react"; import Accordion from "../accordion/accordion"; import { useRouter, usePathname, useSearchParams, useParams, } from "next/navigation"; i ...

Exploring the wonders of nested object destructuring in ES6

How have you been? I want to remove the property "isCorrect" from a nested object. Original List id: 1, questionText: 'This is a test question for tests', answerOptions: [ { answerText: 'A', isCorrect: ...

Struggling with pagination problems in Bootstrap 4 and looking to integrate QR code functionality into your blade template?

I am currently facing an issue with generating a batch of QR codes using the SimpleQR code generator in Laravel blade template on the fly for printing. The problem arises when a page break occurs, as it breaks the QR code. I attempted to use the break-insi ...

Step-by-step guide on utilizing the material-ui AutoComplete feature to filter a table by selecting a key from a list and manually entering

I'm working on developing a filtering system similar to the AWS Dashboard, where users can select a filter key like instance state, which then displays the key in the input field and allows the user to enter a value to search for. I'm attempting ...

What is the most effective way to loop and render elements within JSX?

Trying to achieve this functionality: import React from 'react'; export default class HelloWorld extends React.Component { public render(): JSX.Element { let elements = {"0": "aaaaa"}; return ( ...

What is the process for incorporating Web Assembly scripts into a React Native application?

I find myself wondering if this task is even feasible. If it is doable, I suspect we'll have to utilize WebViews, but maybe I'm just being overly analytical. Attempted to research this topic, but unfortunately, came up empty-handed. ...

Chrome displaying elements out of alignment

Anyone have any insights into why my webpage elements are displaying differently in Chrome compared to IE? It's driving me crazy! Here's a screenshot of how it looks in Chrome: https://i.sstatic.net/xAlEi.jpg And here's how it appears in IE ...

Uploader and viewer tool for HTML5 documents

My website is currently built using PHP and allows users to add and view documents. The current upload process is basic, requiring users to manually input information and then view the document with minimal formatting on a webpage. I am looking to upgrade ...

Storing HTML labels in an array using a jQuery selector in JavaScript can be a

My code snippet in HTML looks like this: <p style:"text-align:center"><label>Question1</label></p> <p style:"text-align:center"><label>Question2</label></p> <p style:"text-align:center"><label>Qu ...

Dynamically load the configuration for a JQuery plugin

Currently, I am utilizing a JQuery plugin from this source. My goal is to dynamically load the configuration of the plugin without directly modifying it within the plugin file. Below are the default options provided by the plugin: $.Slitslider.def ...

Tips for executing an artillery script with customizable parameters

execute my-script.yaml with artillery To access the target, a token is required for authentication. How can I execute the script above using a token? For example: execute my-script.yaml using token 983r2fh29hf2893yr72 ...

What is the best approach to obtain an inventory of inputs from a particular viewpoint?

I am facing an issue where I have a list of products that require the quantities to be returned along with the reason for return. However, I cannot modify the referenced model as it has an impact on multiple values. Can someone guide me on how to retrieve ...

Combining two CSS classes to create an "alias"

Currently, I’m utilizing bootstrap for table styling. For instance: <table class="table table-striped main"> However, the table I want to style is dynamically generated by a separate tool that I have no control over, and it already has its own ta ...

Python Selenium error: NoSuchElementException - Unable to find the specified element

Coding Journey: With limited coding knowledge, I've attempted to learn through various resources without much success. Now, I'm taking a different approach by working on a project idea directly. The goal is to create a program that interacts wi ...

Angular: Transforming input types

When the div is pressed, it triggers a function that changes the type of input. There are two password inputs that are changed to text when the function is triggered. Issue Error 1: 'password' may be null. If I enter '' in the password ...

ngx-slick-carousel: a carousel that loops infinitely and adjusts responsively

I have implemented ngx-slick-carousel to showcase YouTube videos in my project. However, I am facing two main issues. Firstly, the carousel is not infinite, and when the last video is reached, there appears to be white spaces before it loops back to the fi ...