How do I add a web gl hover effect to a container?

I want the image to fit in my container like an object-fit cover and not take the space of whole viewport width. I took inspirations for the effect from this website.

.casestart {
  height: 100vh;
  width: 100vw;
  position: relative;
  overflow: hidden;
}

.imageside {
  width: 52vw;
  height: 100vh;
  position: absolute;
  right: 0;
  background: #000;
}
<div class="casestart">
  <div class="imageside">
    <img id="hoverImage" src="12.webp" alt="" draggable="false" srcset="">
  </div>
</div>

I’ve tried everything man. It doesnt work.

How to write js code into script tags at cshtml file

I am trying to add some animations to my website, but unfortunately, my JS code is not working(which I am writing inside the script tags and have also included here).

I wanted the elements on the page to appear with an animation as I scroll, but my main question is how I can write the JavaScript code I want into the .cshtml file.

enter image description here

Dynamics CRM 2016 on-premises – Javascript Suddenly stopped working

On Premises Dynamics 2016 v 9.0.51.6 Farm Installation

Code was working prior to 8/19
Suddenly this script stopped working with no prior changes made to my form… customers get an error stating process is not defined.

Upon debugging it seems to break right after the reup status returns true
I am at a loss, but it is always helpful to get a second pair of eyes.

What do you guys think?

Debug Error CRM Error

function RenewProgram ()
{
    debugger;
     var reupStatus;
     var processId = "C3B2435A-D08F-4262-9B11-836F47C70866"; // Workflow ID for Reup process
     var accountId;
     var opportunityId;

    responseType = "reup";
    

    accountId = Xrm.Page.data.entity.getId();
        
    try {

      gridRows = Xrm.Page.getControl("Programs").getGrid().getRows();
      gridRows.forEach(function (row, rowIndex) {
    
         opportunityId = row.getData().getEntity().getId();
         currentProgramList.push(opportunityId);
      })
    
     selectedRow = Xrm.Page.getControl("Programs").getGrid().getSelectedRows();
     selectedRow.forEach(function (row, rowIndex) {
            
         attributeColl = row.getData().getEntity().attributes;
         attributeColl.forEach(function (att, attIndex) {
            
             if (att.getName() == "po_distributor"){
                 if (att.getValue() != null && att.getValue() != 'undefined') {
                    renewDistributorID = att.getValue()[0]['id']; //ek
                                        glkPrgmSelectedRowDist = renewDistributorID;

                 }
             }
             if (att.getName() == "po_reupprogram") {
                 if (att.getValue() != null && att.getValue() != 'undefined') {
                     reupStatus = att.getValue();
                 }
                 if (reupStatus == true) {
                     opportunityId = row.getData().getEntity().getId();
                     Process.callWorkflow(processId, opportunityId, successCallback, errorCallback);    
                 }
                
             }
         })
     })

    }
    catch (e) {
        Xrm.Utility.alertDialog(e.message);
    }
}

I tried altering the workflow it is calling by changing the owner and workflow type but that made no change.

InnerHTML of TD with no class or ID in plain JS

This is the image of the HTML with the table

I’m trying to access the innerHTML of the td’s in tr class ‘odd newbook-center’

Tried all kinds of requests but none work

function test() {
return document.querySelector('.odd newbook-center td')[1].innerHTML;
}

function test() {
return document.querySelectorAll('odd newbook-center td')[2].innerText;
}

function test() {
return document.querySelectorAll('.odd newbook-center td')[2].innerText;
}

function test() {
return document.querySelector('pretty_table')[2].innerHTML;
}

function test() {
return document.querySelector('tr.odd newbook-center td:nth-child(1)').textContent;
}

etc etc etc

Can anyone give me some guidance?

How to configure custom preloaded js files in vite

After Vite is packaged, a piece of code like this will be added to the HTML

<link rel="modulepreload" crossorigin href="./static/js/vue-6yrc7NEg.js">

How can I customize the addition, for example, to continue adding the following code based on the original
<link rel="modulepreload" crossorigin href="./static/js/axios-13YDFsaxG.js">
The static directory is generated after subpackaging

I tried to write a plug-in to get it, but it couldn’t get the HTML file, but it could get other files except HTML after packaging.

Best approach to reset default loaded Global Style inside a React component

I have a global styles script as below

/* my_global.scss */

body {
  margin: 0;
}

a:focus {
  outline: thin dotted;
}

/*... and many more (300++ lines) */

These global styles have polluted external components imported from other libraries.

Simple question: how can I keep components from other libraries unchanged and unaffected by these huge my_global.scss styles?

After some research, the possible approaches I found are:

  1. Use pseudo class body:not(.my-library-component)my_global.scss is a long script, and for personal reasons, this method is not recommended.
  2. CSS reset by importing normalize.css – Considering the growing size of library components, I am unsure if this will have any performance impact.
  3. Using all:unset – this is not supported in IE browser
  4. Introducing classno-theme on external components – this will be similar to, or maybe a part of, method 2, which involved CSS reset. Or maybe I am wrong.

Can anyone shed some lights on this, or suggest any other methods (such as using scss or javascript)?

When printing Chrome + Edge cut off last elements, Firefox adds multiple blank pages between

Given a Vuetify app displaying a table where everything is calculated. For this case I’m displaying a minimalistic “Print Spreadsheet View”, so users can print it via Browser. Unfortunately when doing so

  • Chrome and Edge cut off some of the last table rows
  • Firefox adds multiple blank pages between the table

I tried to reproduce it with this code ( playground link )

App.vue

<script setup lang="ts">
  import PrintSpreadsheetView from "./PrintSpreadsheetView.vue";
</script>

<template>
  <v-app>
    <v-main>
      <PrintSpreadsheetView />
    </v-main>
  </v-app>
</template>

<style>
  main {
    height: 100vh;
    display: flex;
    flex-direction: column;
  }

  .v-table__wrapper table {
    table-layout: fixed;
    width: 0 !important;
  }
</style>

PrintSpreadsheetView.vue

<template>
  <v-table>
    <colgroup>
      <col :style="{ width: '200px' }" />
    </colgroup>
    <thead>
      <tr>
        <th>Col</th>
      </tr>
    </thead>
    <tbody>
      <tr v-for="rowIndex in 300">
        <td>cell at row {{rowIndex}}</td>
      </tr>
    </tbody>
  </v-table>
</template>

I know that the CSS from App.vue is the problem, but this component provides some CSS for all “Spreadsheet” views.

Does someone know how to fix the CSS for the print component? Is it possible to deny this one? Or should I copy the CSS from App.vue to all other views except the print one?

Image doesn’t change on src above media query 993px

I’m building a SPA and on one page, I have products with color icons below. When clicking on the icons, the image above should change to the color indicated by the button (using JS, onclick). It works on all media queries 992px and below. Once I hit 993px, it no longer changes the image. What am I missing?
Please click on the “Products” link.
https://allamericanmailboxesofhouston.com/index-design.html

Please note: There are other formatting issues that I am aware of. I’ve made a lot of “experimental” changes in an effort to fix this issue.

TIA!

Building online calculator, unsure how to structure coding logic in JavaScript? [closed]

As a personal project I am trying to code this calculator (https://www.omnicalculator.com/finance/cpc-cpm), however I need some help.

I am unsure how to approach the Javascript logic here? There are 6 fields, and a user can type data into any one of them and it will auto-populate the others when it has the necessary data.

I am not asking for a full coding help, just some hints as to how to approach the logic?

These are the basic formulae I assume the calculator uses:

  1. clicks = impressions * (CTR / 100)
  2. total cost = (impressions * (CTR / 100)) * CPC
  3. CPM = ((impressions * (CTR / 100)) * CPC) / impressions * 1000

But how do they ensure the reverse calculations are done in real-time? Any ideas?

Much appreciated,
Adam

Destructuring with default value returns a function

I am destructuring value out of an object like so;

const response = { data: [] }
const { data: { values } = {} } = response

console logging the value of values, its a native function instead of undefined

If I change the response to have an object as the value of the key data, it works as expected

const response = { data: {} }
const { data: { values } = {} } = response

enter image description here
Am as confused as a squirrel in a maze full of mirrors

JSZip generateAsync TypeError: e3.charCodeAt is not a function


import JSZip from 'jszip';
import FileSaver from 'file-saver';

  const exportData = (evt: any) => {
  var reportFileName = 'myreport.zip';
  const ziptool = new JSZip();
  var blob_raw_data = { id: 'xxxxxxx', bm: 0, em: 1500 }; 
  var jsonse = JSON.stringify(blob_raw_data, null, 't');
  var bytes = new TextEncoder().encode(jsonse);
  var blob = new Blob([bytes], { type: "text/plain;charset=utf-8" });
  ziptool.file('values.txt', blob, {binary: false});
  ziptool.generateAsync({ type: "blob" })
    .then(function (blob_data) {
      FileSaver.saveAs(blob_data, reportFileName);
    }
  );

The error message:


Uncaught (in promise) 
TypeError: e3.charCodeAt is not a function
    at jszip.js?v=79504123:739:68
    at s.utf8encode (jszip.js?v=79504123:742:12)
    at l.processChunk (jszip.js?v=79504123:772:31)
    at s. (jszip.js?v=79504123:596:16)
    at s.emit (jszip.js?v=79504123:588:116)
    at s.push (jszip.js?v=79504123:571:16)
    at s._tick (jszip.js?v=79504123:563:40)
    at s._tickAndRepeat (jszip.js?v=79504123:547:82)
    at jszip.js?v=79504123:537:126

I checked the jszip.js file, it died in this function:


        s.utf8encode = function(e2) {
          return h.nodebuffer ? r.newBufferFrom(e2, "utf-8") : function(e3) {
            var t2, r2, n2, i2, s2, a2 = e3.length, o2 = 0;
            for (i2 = 0; i2 >> 6 : (r2 >> 12 : (t2[s2++] = 240 | r2 >>> 18, t2[s2++] = 128 | r2 >>> 12 & 63), t2[s2++] = 128 | r2 >>> 6 & 63), t2[s2++] = 128 | 63 & r2);
            return t2;
          }(e2);

Nextjs “Fetch failed” even if server is returning 200

I am developing an app in NextJs 14.2.5.

I am encountering an issue when I make a POST using fetch; the server returns the correct response with a 200 status.
I have tested this on Postman as well and that works fine.
But the fetch call on the client throws a Fetch failed error.

Client code (page.tsx)

'use client'
import Link from "next/link";
import { Button } from "react-bootstrap";

// export const dynamic = "force-dynamic";
// export const fetchCache = "force-no-store";

export default function Home() {

  const handleLoginClick = async () => {
    try {
      alert("fetch before");
      const response = await fetch('/api/auth/req', {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
        },
        body: JSON.stringify({ address: 'TQEy5ZbcTZrctHJufE47E9hHzPfvT8SRcE' }),
      });
      alert("fetch after"); // never reaches this line
      const resJson = await response.json();      
    } catch (error) {
      console.error(error);//Always reaches here; server has returned 200
    }
  }

  return (
    <main>
      <div className="App">
      <Button className="nav-link text-white" onClick={handleLoginClick} href="/">Login</Button>
      </div>
    </main>  
  )
}

My API route

// app/api/auth/req/route.js
import { NextResponse } from "next/server";
import dbConnect from "@/lib/dbConnect";
import User from "../../../../models/user";

export async function POST(request, res) {
    try {
      let reqJson = await request.json();
      
      let address = reqJson.address;
      if(!address || !address.length){
        return NextResponse.json({nonce_ : null, msg : 'Address not sent with request'}, { status: 500 });
      }
      console.log(address);

        await dbConnect();

        let nonce  = "somenonce";

        const updatedUser = await User.findOneAndUpdate(
            { address: address },     
            { nonce: nonce },          
            { new: true }             
          );
      
          if (updatedUser) {
            console.log('Nonce updated successfully:', updatedUser);
            return NextResponse.json({ nonce_: nonce }, { status: 200 });
          } else {
            console.log('User not found with the given address.');
            return NextResponse.json({nonce_ : null, msg : 'User not found with the given address.'}, { status: 500 });
          }

    } catch (error) {
        console.log(error);
        console.log("fail");
    }
    return NextResponse.json({nonce_ : null}, { status: 500 });
}

Why is the client failing with this error?
And how should i fix it?

Here is what i have tried

  1. As per this post
    https://stackoverflow.com/questions/57477805/why-do-i-get-fetch-failed-loading-when-it-actually-worked
  • I have attempted to send a 204 status; no luck 204 is not recognized
  • The NextResponse has a body (nonce_ : nonce); still no luck
  1. I am assuming that cors handling works out of the box in Nextjs. So I havent done anything to handle that.

  2. As per this blog
    https://medium.com/phantom3/next-js-14-build-prerender-error-fix-f3c51de2fe1d
    I have also set the following in the client; this didnt work either

export const dynamic = "force-dynamic";
export const fetchCache = "force-no-store";
  1. I checked – on the server the code executes in very less time – about 151 ms. Just in case there maybe a delay on the server side.

Solution
Thanks to Phils suggestion below I simply removed the href attribute from the button and all worked correctly.

Jquery phone image fader caroseul

enter image description here

Trying to create this image replacement carousel. There is a transform in the x axis and a fade – what is the best approach at making something custom.

Being able to control the transition and duration of the swiper. Have the option of adding arrows and dot navigation later.

https://jsfiddle.net/xezhp6qa/5/

  $(document).ready(function() {

    console.log("ready")
    var myElement = $(".phone-slide");

    function setTransform(xPos, el) {
      el.style.transform = `transition: all; transform: translateX(${xPos}px); opacity: 1; z-index: 798; visibility: hidden;`;
    }

        var count = 0;
    setInterval(function() {
        console.log("interval---")
      setTransform(-200*count, myElement[0])
      count++;
    }, 3000);




  });
.section.light-blue-bg {
    background-color: #f4f8fb;
}

.container.phone-container {
    padding-top: 6rem;
    padding-bottom: 0rem;
}



.container {
    max-width: 1170px;
    margin-right: auto;
    margin-left: auto;
    padding: 3rem 1em;
}



@media screen and (min-width: 1280px) {
    .container {
        max-width: 1280px;
    }
}



.grid-6-col {
    width: 100%;
    grid-column-gap: 1em;
    grid-row-gap: 1em;
    -ms-grid-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
    -ms-grid-rows: auto;
    grid-template-rows: auto;
}


#w-node-a136e70e-a0ad-9d01-ec68-2e537ec8b5e7-ac768e33 {
    -ms-grid-column: span 3;
    grid-column-start: span 3;
    -ms-grid-column-span: 3;
    grid-column-end: span 3;
    -ms-grid-row: span 1;
    grid-row-start: span 1;
    -ms-grid-row-span: 1;
    grid-row-end: span 1;
}


#w-node-_137c2bb4-4509-ee79-0592-7207c42c0509-ac768e33 {
    -ms-grid-column: span 3;
    grid-column-start: span 3;
    -ms-grid-column-span: 3;
    grid-column-end: span 3;
    -ms-grid-row: span 1;
    grid-row-start: span 1;
    -ms-grid-row-span: 1;
    grid-row-end: span 1;
}

.phone-holder-container {
    position: relative;
    z-index: 2;
    overflow: hidden;
    height: 750px;
}


.phone-slider-container {
    position: absolute;
    left: 75px;
    top: 25px;
    right: auto;
    z-index: -1;
    width: 239px;
    height: 511px;
    background-color: rgba(250, 88, 83, 0.61);
}



img {
    display: inline-block;
    max-width: 100%;
}

.phone-holder-image {
    width: 530px;
    min-width: 530px;
}



.w-slider {
    position: relative;
    height: 300px;
    text-align: center;
    background: #dddddd;
    clear: both;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    tap-highlight-color: rgba(0, 0, 0, 0);
}



.phone-slider {
    position: absolute;
    left: 0%;
    top: 0%;
    right: 0%;
    bottom: 0%;
    width: 100%;
    height: 100%;
}



.w-slider-mask {
    position: relative;
    display: block;
    overflow: hidden;
    z-index: 1;
    left: 0;
    right: 0;
    height: 100%;
    white-space: nowrap;
}


.phone-slider-mask {
    width: 100%;
    height: 100%;
}


.phone-slide {
    position: relative;
}

.phone-slide-image {
    width: 100%;
    height: 100%;
    -o-object-fit: cover;
    object-fit: cover;
}



.w-slider-arrow-left, .w-slider-arrow-right {
    position: absolute;
    width: 80px;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    margin: auto;
    cursor: pointer;
    overflow: hidden;
    color: white;
    font-size: 40px;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    tap-highlight-color: rgba(0, 0, 0, 0);
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}


.w-slider-arrow-left {
    z-index: 3;
    right: auto;
}


.phone-slider-arrows {
    display: none;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<div id="Download" class="section light-blue-bg" style="will-change: background; background-color: rgb(244, 248, 251);">
  <div class="container phone-container">
    <div class="w-layout-grid grid-6-col">
      <div id="w-node-a136e70e-a0ad-9d01-ec68-2e537ec8b5e7-ac768e33" class="content phone-content-text">
       xxx
      </div>
      <div id="w-node-_137c2bb4-4509-ee79-0592-7207c42c0509-ac768e33" class="content">
        <div data-w-id="6bff453a-e257-79ae-5a82-6ee7a87dc6d0" style="opacity: 1;" class="phone-holder-container">
          <div class="phone-slider-container">
            <div data-delay="3000" data-animation="fade" class="phone-slider w-slider" data-autoplay="true" data-easing="ease" data-hide-arrows="false" data-disable-swipe="false" data-autoplay-limit="0" data-nav-spacing="3" data-duration="500" data-infinite="true" role="region" aria-label="carousel">
              <div class="phone-slider-mask w-slider-mask" id="w-slider-mask-0">
                <div class="phone-slide w-slide" aria-label="1 of 3" role="group" style="transition: all; transform: translateX(0px); opacity: 1; z-index: 540;" aria-hidden="true"><img src="https://assets.website-files.com/604b35876a71cbbd84768e36/604d4b5ee9f5d3561967d646_ChatList-White.jpg" loading="lazy" sizes="(max-width: 479px) 158px, 239px" srcset="https://assets.website-files.com/604b35876a71cbbd84768e36/604d4b5ee9f5d3561967d646_ChatList-White-p-500.jpeg 500w, https://assets.website-files.com/604b35876a71cbbd84768e36/604d4b5ee9f5d3561967d646_ChatList-White.jpg 750w" alt="" class="phone-slide-image" aria-hidden="true"></div>
                <div class="phone-slide w-slide" aria-label="2 of 3" role="group" style="transition: all, opacity 500ms; transform: translateX(-239px); opacity: 1; z-index: 541;"><img src="https://assets.website-files.com/604b35876a71cbbd84768e36/604d4b5d2582aa2cb7e78d36_Calendar1.png" loading="lazy" sizes="(max-width: 479px) 158px, 239px" srcset="https://assets.website-files.com/604b35876a71cbbd84768e36/604d4b5d2582aa2cb7e78d36_Calendar1-p-500.png 500w, https://assets.website-files.com/604b35876a71cbbd84768e36/604d4b5d2582aa2cb7e78d36_Calendar1.png 1125w" alt="" class="phone-slide-image"></div>
                <div class="phone-slide w-slide" aria-label="3 of 3" role="group" style="transition: all; transform: translateX(0px); opacity: 1; z-index: 539; visibility: hidden;" aria-hidden="true"><img src="https://assets.website-files.com/604b35876a71cbbd84768e36/604d4b5db64f644b318b64f9_Calendar2.png" loading="lazy" sizes="(max-width: 479px) 158px, 239px" srcset="https://assets.website-files.com/604b35876a71cbbd84768e36/604d4b5db64f644b318b64f9_Calendar2-p-500.png 500w, https://assets.website-files.com/604b35876a71cbbd84768e36/604d4b5db64f644b318b64f9_Calendar2.png 1125w" alt="" class="phone-slide-image" aria-hidden="true"></div>
                <div aria-live="off" aria-atomic="true" class="w-slider-aria-label" data-wf-ignore="">Slide 2 of 3.</div>
              </div>
              <div class="phone-slider-arrows w-slider-arrow-left" role="button" tabindex="0" aria-controls="w-slider-mask-0" aria-label="previous slide">
                <div class="w-icon-slider-left"></div>
              </div>
              <div class="phone-slider-arrows w-slider-arrow-right" role="button" tabindex="0" aria-controls="w-slider-mask-0" aria-label="next slide" style="">
                <div class="w-icon-slider-right"></div>
              </div>
              <div class="phone-slide-nav w-slider-nav w-round">
                <div class="w-slider-dot" data-wf-ignore="" aria-label="Show slide 1 of 3" aria-pressed="false" role="button" tabindex="-1" style="margin-left: 3px; margin-right: 3px;"></div>
                <div class="w-slider-dot w-active" data-wf-ignore="" aria-label="Show slide 2 of 3" aria-pressed="true" role="button" tabindex="0" style="margin-left: 3px; margin-right: 3px;"></div>
                <div class="w-slider-dot" data-wf-ignore="" aria-label="Show slide 3 of 3" aria-pressed="false" role="button" tabindex="-1" style="margin-left: 3px; margin-right: 3px;"></div>
              </div>
            </div>
          </div><img src="https://assets.website-files.com/604b35876a71cbbd84768e36/604dfffd690126842fd21112_Hand-iPhoneX.png" loading="lazy" alt="" class="phone-holder-image">
        </div>
      </div>
    </div>
  </div>
</div>

How to retrieve original JS native constructor if they are changed? Say Map

I am working on a browser extension where I am using a library which need to use Native js Map. However it’s definition has been changed by the host application. Additionally library which I am using need Native Map at the time of loading. Is there a way I can retrieve original Map definition?

I tried below 2 approaches.

  1. constructing new iframe and access it’s Map definition. Problem was that library uses Map on load and I can’t pass Map definition to it.

  2. Used web worker. Chrome MV3 is not allowing to create a new Worker from the content script.

How does the one cart checkout from multiple websites in websites like revolve or apps like Styl.AI work?

I am currently beginning to learn web/app development and was curious as to how different multi-brand aggregation platforms like Revolve or the newly launched iOS app Styl.AI do this?

Do you need to have a agreement with the seller to create order requests on their platform through your app? Or can anyone build this? Is there a particular react native app code that can accomplish this and place orders on external websites and track the same order?

I have tried searching for answers online and could only find ways to implement a shopping cart for just your own website but not to place orders on external ones.