View Transition API: Tab Animation Scaling Issue

I’m experimenting a smooth tab switch animation using the View Transition API.

In my CodePen example (https://codepen.io/moorthy-g/pen/ByaQZBv), switching from ‘Introduction’ to ‘Technology’ is smooth. However, switching to ‘Storytelling in a Small Village’ causes the active element to scale. How can I prevent this scaling behavior and maintain a smooth slide animation for all tab width transitions?

<div class="content">
    <div class="tabs">
        <div class="tab active" data-tab="1">Introduction</div>
        <div class="tab" data-tab="2">Storytelling in a Small Village</div>
        <div class="tab" data-tab="3">Technology</div>
    </div>
    <div class="tab-content">
        <div data-tab-content="1" style="display: block">
            <p>Lorem ipsum dolor sit amet.</p>
        </div>
        <div data-tab-content="2" style="display: none">
            <p>In a faraway land, there was a small village.</p>
        </div>
        <div data-tab-content="3" style="display: none">
            <p>Technology has transformed the world.</p>
        </div>
    </div>
</div>
.tabs {
    position: relative;
}

.tab {
    padding: 10px;
    background-color: #f0f0f0;
    cursor: pointer;
    position: relative;
    z-index: 0;
    overflow: hidden;
    display: inline-block;
}

.tab:hover {
    background-color: #fff;
}

.tab.active {
    color: #fff;
}

.tab.active::after {
    view-transition-name: tab;
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: #007bff;
    z-index: -1;
}

.tab-content {
    padding: 20px;
}

::view-transition-group(tab) {
    animation-duration: 0.5s;
}
const tabs = document.querySelectorAll(".tab");
const tabContents = document.querySelectorAll(".tab-content > div");
let currentTab = 0;
tabs.forEach((tab, index) => {
    tab.addEventListener("click", () => {
        currentTab = index;
        document.startViewTransition(() => {
            tabs.forEach((t, i) => {
                if (i === currentTab) {
                    t.classList.add("active");
                } else {
                    t.classList.remove("active");
                }
            });
        });
        tabContents.forEach((tc, i) => {
            if (i === currentTab) {
                tc.style.display = "block";
            } else {
                tc.style.display = "none";
            }
        });
    });
});

// Set the first tab as default
document.querySelector(".tab").click();

Values between objects are different but behavior suggests they are all the same

I have a number of objects in a browser game I’m working on, each object is a particle and is given a random velocity upon creation, however when playing, all particles move in the same direction as a group, I have double and triple checked that, yes, all the values are indeed set correctly, and each particle has its own random velocity. Yet all particles still move in the same direction, I’m totally stumped.

Update method for the particle class (runs every frame)

    update(){
        this.lifespan += -20
        if(this.lifespan <= 0) this.del_me = true

        this.pos.x += this.velocity.x
        this.pos.y += this.velocity.y

        this.draw()
        }

Constructor for particle class

    constructor({ pos, velocity, color, lifespan }){
        this.pos = pos
        this.velocity = velocity
        this.size = {w: 5, h: 5}
        this.color = color
        this.start_lifespan = lifespan
        this.lifespan = this.start_lifespan
        this.del_me = false
        }

Function for spawning a particle

function spawnParticle(pos, velocity, color, lifespan){
    objects.push(
        new Particle({
            pos: pos,
            velocity: velocity,
            color: color,
            lifespan: lifespan
            })
        )
    }

Function for confetti effect

function splat(pos, particles, color, lifespan){
    for(let i=0; i<particles; i++)
        spawnParticle(pos, {x: random_int(10)/10, y: random_int(10)/10}, color, lifespan)
    console.log(objects)
    }

(console output indicates that all velocities are indeed different and random, including negative values)

Originally I thought the problem was that my random function was only returning positive values, which would lead to all particles going to the bottom right of the screen, however I fixed this problem and they continued to behave like this. Even more confusing is that I tried setting a random velocity every frame in the above “update” method and the particles dispersed more yet still moved as a “cloud” instead of randomly spreading out like expected.

CSS Problem with Sidemenu Rotating to Reveal Underside

Hello everyone hope this letter finds you well, today I have an issue with my Reveal-sidemenu-circle; the point is for the person to click on the icon and then the circle will rotate and the top page will move to the side to reveal an li-tag with options. Thus far I have tried to tweak parts of the css and html but noting seems to work, I shuld note that it also includes JS and I also double-checked the queryselectors and const as well and have zero errors in the console. However even with all this my sideMenu is still NOT working; every time I press the button its just Static and noting happens. I have included all my source code below.

const fongola = document.getElementById('fongola');

const kanga = document.getElementById('kanga');

const container = document.querySelector('.container');

fongola.addEventListener('click', ()=> container.classList.add('lakisa-menu'));     


kanga.addEventListener('click', ()=> container.classList.remove('lakisa-menu'));
.container{
    background:#fafafa;
    transform-origin:top left ;
    transition: transform 0.5s linear;
    width:100vw;
    min-height:100vh ;
    padding:50px;
}


.container .lakisa-menu{
    transform: rotate(-20deg);


}


.circle-container{
    position: fixed;
    top:-100px;
    left:-100px;

}


.circle{
    background-color:#0063b4 ;
    height:200px;
    width:200px;
    border-radius:50%;
    position: relative;
    transition:transform 0.5s linear;
}

/*  big blue SPINNER */
.container .lakisa-menu .circle{
    transform: rotate(-70deg);

}



.circle button{
    cursor:pointer;
    position: absolute;
    top:50%;
    left:50%;
    height:100px;
    background:transparent;
    border:0;
    font-size:26px ;
    color:#fff;

}

/* pseudo-class */
.circle button:focus{
    outline:none;

}


.circle button#fongola{
    left:60%;
}


.circle button#kanga{
    transform:rotate(90deg);
    transform-origin: top left;
    top:60%;


}

.container .lakisa-menu + nav li{
    transform: translateX(0);   
    transition-delay: 0.3s;


}


nav{
    position: fixed;
    bottom:40px;
    left:0;
    z-index: 1;
}



nav ul{
    list-style-type: none;
    padding-left: 30px;


}

nav ul li{
    text-transform: uppercase;
    color:#fff;
    margin:40px 0;
    transform: translateX(-100%);
    transition: transform 0.4s ease-in;
}

nav ul li{
    font-size:20px;
    margin-right:10px;
}

nav ul li + li{
    margin-left:15px;
    transform:translateX(-150%);

}


nav ul li + li + li{
    margin-left:30px ;
    transfrom:translateX(-200%);

}
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Porfolio</title>
    <link rel="stylesheet"  href="styling.css">


</head>
<body>


<nav>
    <ul>
    <li class="list"></li>  
    <li class="list"></li>
    
    </ul>



</nav>


<div class="container">
    

    <div class="circle-container">
        
            <div class="circle">
                    <button id="kanga">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-book" viewBox="0 0 16 16">
  <path d="M1 2.828c.885-.37 2.154-.769 3.388-.893 1.33-.134 2.458.063 3.112.752v9.746c-.935-.53-2.12-.603-3.213-.493-1.18.12-2.37.461-3.287.811zm7.5-.141c.654-.689 1.782-.886 3.112-.752 1.234.124 2.503.523 3.388.893v9.923c-.918-.35-2.107-.692-3.287-.81-1.094-.111-2.278-.039-3.213.492zM8 1.783C7.015.936 5.587.81 4.287.94c-1.514.153-3.042.672-3.994 1.105A.5.5 0 0 0 0 2.5v11a.5.5 0 0 0 .707.455c.882-.4 2.303-.881 3.68-1.02 1.409-.142 2.59.087 3.223.877a.5.5 0 0 0 .78 0c.633-.79 1.814-1.019 3.222-.877 1.378.139 2.8.62 3.681 1.02A.5.5 0 0 0 16 13.5v-11a.5.5 0 0 0-.293-.455c-.952-.433-2.48-.952-3.994-1.105C10.413.809 8.985.936 8 1.783"/>
</svg>
                    </button>

                        <button id="fongola">
                            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-code-slash" viewBox="0 0 16 16">
  <path d="M10.478 1.647a.5.5 0 1 0-.956-.294l-4 13a.5.5 0 0 0 .956.294zM4.854 4.146a.5.5 0 0 1 0 .708L1.707 8l3.147 3.146a.5.5 0 0 1-.708.708l-3.5-3.5a.5.5 0 0 1 0-.708l3.5-3.5a.5.5 0 0 1 .708 0m6.292 0a.5.5 0 0 0 0 .708L14.293 8l-3.147 3.146a.5.5 0 0 0 .708.708l3.5-3.5a.5.5 0 0 0 0-.708l-3.5-3.5a.5.5 0 0 0-.708 0"/>
</svg>

                        </button>





            </div>
            <!----circle---->




    </div>
    <!----circle-container--->
        <div class="content">
        <h2>Josue </h2>             
            <p>
                
                On my days of I enjoy going out to the internet-cafe and sipping on a mocha latte.







            </p>


            </div>
            



</div>
<!---container ends here-->


    
    <script src="theScript.js" type="text/javascript"></script>
</body>
</html>

Livewire 3: livewire.js?id=65f3e655:450 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘uri’)

Recently i was using livewire 3 to try some stuff like SPA like experience using wire:navigate on my navbar. everything is looks fine on local development, it doesnt show any error, its working perfectly like it should be.
But when im push it to my production, BOOMM!!. my navbar is crashing cause wire:navigate feature.

it show an error like this:

enter image

i dont know what’s wrong. the feature called offline state using wire:offline seems fine on production. here step to reproduce:

<a wire:navigate class="group flex w-full items-center rounded-xl p-2 pl-11 text-gray-900 hover:bg-gray-100 hover:text-red-600 dark:text-gray-300 dark:hover:bg-transparent" href="{{ route('backup.index') }}" wire:current.exact="text-red-600 font-bold bg-gray-100 dark:bg-[#18181b]"> 
   <x-icons.filezip class="h-6 w-6 text-gray-400 group-hover:text-red-600" wire:current.exact="text-red-600" />
   <span class="ms-3 flex-1 whitespace-nowrap text-sm group-hover:text-red-600">Manage Backups</span>
</a>

i have try several solutions on internet like:

  1. from another stack overflow post
    here.
  2. solution from caleb porzio itself on one of github issue post.

and none of them is work.

Fullcalendar v6 change height of rows in a resourceTimeline view

In resourceTimeLine views i want to make the height of the rows a bit smaller so that the events fit exactly in the row height. Now there’s unused space underneath the displayed events. If i can make the rows smaller this way i can display more resources on the screen without scrolling.

I found this answer and it works for an older version.
Can anyone help me to find a solution for version 6 of Fullcalendar?

.fc-event-container[style] {
   height: 59% !important;
}

.fc-event[style] {
   height: 100% !important;
}

Difficulties with fade-out/in javascript animation for website content

On my site, I have a container that holds multiple ‘pages’ of information. When a button is clicked, the current content page disappears and the next one appears on screen, allowing viewers to cycle through different windows of content on the same webpage. The buttons work perfectly, but I’m not having success with animating it. I want the text of the current page to move to the left and fade out while the next page fades in from the right. Here is what I have so far.

function fadeOutShowNext(currentId, nextId){
    const currentSection = document.getElementById(currentId);
    const nextSection = document.getElementById(nextId);

    currentSection.classList.add('fade-out');

    setTimeout(() => {
        currentSection.style.display = 'none';
        nextSection.style.display = 'block';
        
        nextSection.classList.remove('fade-out');
    }, 1000);

}

currentId and nextId are passed through from the button clicks. No problems there.
Here is my fade-out class from my CSS:

.fade-out {
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

As of right now, the text fades out like it should. However, if I try to add a similar fade-in class, it causes the fade-out effect to stop working. I’ve tried using ChatGPT for but it is not being any help at all. I’m not sure what I’m doing wrong. Everything in the current code makes sense to me but when trying to replicate the logic to add the additional effects, the fade-out animation just stops working. I would appreciate any assistance.

An unhandled rejection has occurred inside Forge: HttpError: Not Found when publish electron-forge

when i tried to publish my electron-forge vite

this is my forge.config.js

const { FusesPlugin } = require('@electron-forge/plugin-fuses');
const { FuseV1Options, FuseVersion } = require('@electron/fuses');

module.exports = {
  packagerConfig: {
    asar: true,
  },
  rebuildConfig: {},
  makers: [
    {
      name: '@electron-forge/maker-squirrel',
      config: {},
    },
    {
      name: '@electron-forge/maker-zip',
      platforms: ['darwin'],
    },
    {
      name: '@electron-forge/maker-deb',
      config: {},
    },
    {
      name: '@electron-forge/maker-rpm',
      config: {},
    },
  ],
  publishers: [
    {
      name: '@electron-forge/publisher-github',
      config: {
        repository: {
          owner: 'myname', 
          name: 'myrepo',
        },
        prerelease: false, 
        draft: false,
      },
    },
  ],
  plugins: [
    {
      name: '@electron-forge/plugin-vite',
      config: {
        build: [
          {
            entry: 'src/main.js',
            config: 'vite.main.config.mjs',
            target: 'main',
          },
          {
            entry: 'src/preload.js',
            config: 'vite.preload.config.mjs',
            target: 'preload',
          },
        ],
        renderer: [
          {
            name: 'main_window',
            config: 'vite.renderer.config.mjs',
          },
        ],
      },
    },
    new FusesPlugin({
      version: FuseVersion.V1,
      [FuseV1Options.RunAsNode]: false,
      [FuseV1Options.EnableCookieEncryption]: true,
      [FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
      [FuseV1Options.EnableNodeCliInspectArguments]: false,
      [FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
      [FuseV1Options.OnlyLoadAppFromAsar]: true,
    }),
  ],
};

And im already create an release at that repo in the same version but still got

erorr ❯ Publishing distributables ✖ [publisher-github] Running the publish command› Not Found› Uploading distributable (0/1 to v1.0.0)

An unhandled rejection has occurred inside Forge:HttpError: Not Found

Anyone have some solution ?

Publish my electron-forge app

Knex query with column name using the “Delete” Reserved Word

Say I have a SQL table named “Customers” that has a column named Delete (used in order to flag the row as deleted without losing the data in case we want to restore it or access logs from it, etc).

How can I write my knex query so that I can query against the Delete column and get the expected results?

Normally to write a SQL query for this table, if I wanted to get all entries that weren’t marked as deleted, I would do the following:

SELECT * FROM Customers WHERE [Delete] = false

This works fine and gets around the fact that “Delete” is a reserved word.

When I try to write the same query in Knex though:

this.knex("Customers").where("Delete", false).select()

I receive 0 results. I’ve tried using .where("[Delete]",false) as well, but it also returns 0 results.

How to access elements of this JavaScript object?

I am working with integrating Google Adsense ads settings based on the user cookie settings, and I reached this adsbygoogle object.

adsbygoogle=window.adsbygoogle||[];

console.log(adsbygoogle);

That part returns this:

enter image description here

I don’t know how to fetch the values of pauseAdRequests and requestNonPersonalizedAds from that object.

What I tried was this, without getting the value from that requestNonPersonalizedAds:

adsbygoogle=window.adsbygoogle||[];

console.log(adsbygoogle.requestNonPersonalizedAds);
console.log(adsbygoogle[0]['requestNonPersonalizedAds']);
console.log(adsbygoogle['requestNonPersonalizedAds']);

Chart.js tooltips not showing text with plugin callback label

I am trying to get custom tooltips on my chart. For some reason these tooltips aren’t working. Any help is appreciated.

head

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chart.umd.min.js"></script>

body

<div><canvas id="chart1"></canvas></div>
<script>
 const chart1=new Chart(document.getElementById('chart1'),{
  type:'doughnut',
  data:{
   datasets:[{
    data:[50,35,10,5],
    backgroundColor:['#f5aa0b','#a41e34','#005698','#abd2f1'],
    borderWidth:2,
    labels:['Mining','Technology','Healthcare','Other']
   },{
    data:[15,15,10,5,5,15,10,5,5,10,3,1,1],
    backgroundColor:['rgba(245,170,11,1)','rgba(245,170,11,1)','rgba(245,170,11,.8)','rgba(245,170,11,.6)','rgba(245,170,11,.4)','rgba(164,30,52,1)','rgba(164,30,52,.8)','rgba(164,30,52,.6)','rgba(164,30,52,.4)','rgba(0,86,152,1)','rgba(171,210,241,1)','rgba(171,210,241,.8)','rgba(171,210,241,.6)'],
    borderWidth:2,
    labels:['Gold','Silver','Copper','Oil & Gas','Other','Fintech','AI','Quantum','Other','Biotech','Staples','Real Estate','Other']
   }]
  },
  options:{
   plugins:{
    tooltips:{
     callbacks:{
       title:function(tooltipItem,data){
        var dataset=data.datasets[tooltipItem.datasetIndex];
        var index=tooltipItem.index;
        return dataset.labels[index] + ': ' + dataset.data[index] + '%';
      }
     }
    }
   }
  }
 });
</script>

My only thought is that I haven’t initialized the plugin somehow? But I am unsure how to do that in my case.

It should show for example “Mining: 50%” but instead it shows:

enter image description here

Change structure of javascript array to simplify data

I have an array of arrays that looks like this:

[
  [
    "Group One",
    [
      { "id": 1, "type": "b" },
      { "id": 2, "type": "f" },
      { "id": 3, "type": "m" }
    ]
  ],
  [
    "Group Two",
    [
      { "id": 4, "type": "a" },
      { "id": 5, "type": "d" },
      { "id": 6, "type": "f" }
    ]
  ],
  [
    "Group Three",
    [
      { "id": 7, "type": "c" },
      { "id": 8, "type": "m" },
      { "id": 9, "type": "q" }
    ]
  ],
  [
    "Group Four",
    [
      { "id": 10, "type": "a" },
      { "id": 11, "type": "m" },
      { "id": 12, "type": "p" }
    ]
  ]
]

I want to transform this into an array of objects that looks like this:

[
  { "group": "Group One", "type": "b" },
  { "group": "Group One", "type": "f" },
  { "group": "Group One", "type": "m" },
  { "group": "Group Two", "type": "a" },
  { "group": "Group Two", "type": "d" },
  { "group": "Group Two", "type": "f" },
  { "group": "Group Three", "type": "c" },
  { "group": "Group Three", "type": "m" },
  { "group": "Group Three", "type": "q" },
  { "group": "Group Four", "type": "a" },
  { "group": "Group Four", "type": "m" },
  { "group": "Group Four", "type": "p" }
]

I tried this:

const grouped = [["Group One",[{"id":1,"type":"b"},{"id":2,"type":"f"},{"id":3,"type":"m"}]],["Group Two",[{"id":4,"type":"a"},{"id":5,"type":"d"},{"id":6,"type":"f"}]],["Group Three",[{"id":7,"type":"c"},{"id":8,"type":"m"},{"id":9,"type":"q"}]],["Group Four",[{"id":10,"type":"a"},{"id":11,"type":"m"},{"id":12,"type":"p"}]]];

let arrGroup = Array.from(grouped).reduce((acc, curr) => {
  let obj = [];
  curr[1].forEach((item) => (obj[item[0]] = item[1]));
  acc[curr[0]] = obj;
  return acc;
}, {});
console.log('ArrGroup', arrGroup);

but it’s not helping. I’m not sure what to search to figure out this particular data structure.

Unable to replace encoded characters from xml data

I’m pulling information from the board game geek API which returns it’s data in xml format. I’m receiving many issues with character encoding where I perform the request like this:

fetch("https://boardgamegeek.com/xmlapi2/thing?id=128882")
  .then(res => res.text())
  .then(console.log);

I’m running the code with the command: node dist/index.js > test.txt in order to send the above console log to a text file. In that file (and anywhere else I’ve attempted to use the resulting string) I have issues with encoded characters. For example, em spaces appear as ΓÇô and any foreign characters are also decoded into garbage (e.g., 레지스탕스 아발론 becomes δáê∞ºÇ∞èñφâò∞èñ ∞òäδ░£δíá)

I’ve tried str.replace(/ΓÇô/g, "-") which does nothing. I’ve tried to find entity codes for these characters and replace those but it doesn’t seem to replace anything. I feel like there’s a standard way to handle this encoding issue but I’m unable to find it.

Is it possible to use react router for a react project that is embedded in a .NET page?

I have an existing web app written in mostly .net. Im trying to start encorporating react into the website. I have a small react project written for a new module. I need to be able to add this into my web site and I would like to be able to use routing in the react app but Im running into issues.

I have the react project embedded in an existing .net page using webpack. Im basically just using the .net page as a container because my web app has a nav layout that Im not ready to convert to react too. Here is the snippit for that section:

<div id='reactapp'>
   <div id="reactcontent"></div>
   <script type="text/javascript" src="../Scripts/reactapp.bundle.js"></script>
</div>

This page has a url like this: localhost/ReactProject/ReactPageContainer.aspx

If I dont use React router my component loads no problem but now I get the error: No routes matched location “/ReactPageContainer.aspx”

My routing in my react app looks like this:

function App() {
 return (
 <Router basename='/ReactProject'>
    <Routes>
      <Route path="/ReactPageContainer.aspx/" element={<Layout />}>
        <Route index element={
          <PrivateRoute>
            <ReactPage/>
          </PrivateRoute>
        } />
        <Route path="*" element={<NotAuthorized />} />
      </Route>
    </Routes>
</Router>
);
}

Is there a way to get routing to work with my project inside .net like this?

Modal popup pitch-zooming vs page zooming (mobile phone)

I created a modal gallery and when it opens, the user on the phone can zoom in on the image in it (pitch-zoom)… The problem arises when the user closes the modal gallery, then the zoomed page appears. How can I prevent that when the user zooms in on an image in the modal gallery the entire page below zooms in?

How to scale a PNG image in SVG pattern properly

I have a task – create an ability to fill SVG paths with PNG image and scale up and down this image to create a certain texture.

One solution is to create a pattern with image and fill paths with that pattern, and then scale image by css transform: scale(0.7). Image will scale ok, but this solution depends on image dimension – e.g for SVG 1000x1000px with path ~ 800x500px, image 1000×1000 will not cover all path space for scale 0.5.

Here is some code example with another solution I found:

<svg width="1000" height="1000" viewBox="0 0 1000 1000">
    <defs>
     <pattern id="patternImg" height="100%" width="100%" x="0" y="0" preserveAspectRatio="none" patternUnits="objectBoundingBox" viewBox="0 0 1000 1000">

        <image preserveAspectRatio="none" xlink:href="data:image/....." x="0" y="0" width="100%" height="100%" style="transform: scale(0.7);/>
      </pattern>
    </defs>
  
   
    <path d="....." fill="url(#patternImg)" stroke="black"/>
    <path d="....." fill="url(#patternImg)" stroke="black"/>
</svg>

In this case PNG image will fully fit into paths within viewBox 1000×1000, the more dimension, the smaller scaling, and then I can scale up to have bigger size. But the issue with such approach is that paths can have different width/height, and applying viewBox=”0 0 1000 1000″ to all of them will stretch/compress image.

What is the proper solution to solve such tasks?

Note, that it’s not possible to create pattern image by myself, e.g using <rect> and then repeat it. It’s important to use a specific images.