GSAP ScrollTrigger pinning not working when parent has CSS filter applied

gsap.registerPlugin(ScrollTrigger);

ScrollTrigger.create({
  trigger: ".page-0",
  start: "top top", 
  end: "bottom",
  pin: ".season"
});

ScrollTrigger.create({
  trigger: ".page-1",
  start: "top top", 
  end: "bottom",
  pin: ".winter"
});

ScrollTrigger.create({
  trigger: ".page-2",
  start: "top top", 
  end: "bottom",
  pin: ".summer"
});

ScrollTrigger.create({
  trigger: ".page-3",
  start: "top top", 
  end: "bottom",
  pin: ".spring"
});

ScrollTrigger.create({
  trigger: ".page-4",
  start: "top top", 
  end: "bottom",
  pin: ".fall"
});
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
*{
  margin: 0;
  padding: 0;
}
body{
  font-family: "Inter", sans-serif;
  filter: grayscale(100%);
}
.page{
  width: 100%;
  height: 100vh;
  position: relative;
}
.season{
  width: 100%;
  height: 100vh;
  background-image: url("https://static.vecteezy.com/system/resources/previews/036/226/450/non_2x/ai-generated-nature-landscapes-background-free-photo.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.winter{
  width: 100%;
  height: 100vh;
  background-image: url("https://wallpapers.com/images/hd/winter-scene-bridge-n3beaqbjiy0xvdbc.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.summer{
  width: 100%;
  height: 100vh;
  background-image: url("https://images.pexels.com/photos/1450353/pexels-photo-1450353.jpeg?cs=srgb&dl=pexels-asadphoto-1450353.jpg&fm=jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.spring{
  width: 100%;
  height: 100vh;
  background-image: url("https://i.pinimg.com/736x/f5/9b/90/f59b90781e5248d6c5b522f1d3b6df21.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.fall{
  width: 100%;
  height: 100vh;
  background-image: url("https://images.pexels.com/photos/1114896/pexels-photo-1114896.jpeg?cs=srgb&dl=pexels-jplenio-1114896.jpg&fm=jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
#overflow{
  width: 100%;
  height: 100vh;
  position: absolute;
  background: #000;
  opacity: 0.5;
}

h1{
  color: #fff;
  font-size: 14vw;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2vw;
  z-index: 10;
}
<div class="page-0 page">
  <div class="season">
    <div id="overflow"></div>
    <h1>Season</h1></div>
</div>
<div class="page-1 page">
  <div class="winter">
    <div id="overflow"></div>
    <h1>Winter</h1></div>
</div>
<div class="page-2 page">
  <div class="summer">
    <div id="overflow"></div>
    <h1>Summer</h1></div>
</div>
<div class="page-3 page">
  <div class="spring">
    <div id="overflow"></div>
    <h1>Spring</h1></div>
</div>
<div class="page-4 page">
  <div class="fall">
    <div id="overflow"></div>
    <h1>fall</h1></div>
</div>

When I apply a CSS filter property (such as filter: blur() or filter: grayscale()or other CSS filters.) to a top-level parent element like body, and then try to pin a child element using GSAP’s ScrollTrigger, the pinning stops working.

How can I apply a CSS filter to a parent element while still allowing GSAP’s pinning to work properly for its child elements?

codepen:https://codepen.io/bw_ky/pen/vEEYGYp

Recalculate content top-margin if fixed banner is closed

On mobile I have a fixed navbar, with closeable message banner(s) fixed below that – I’m adding marginBlockStart to the page wrapper in js – what I would like is to have the code run and re-run the calculation if a message banner is closed. Here’s my attempt:

// add a margin on page-wrapper to allow for banners at mobile size (fixed header)

function pageWrapperMargin() {

  const mediaQuery = window.matchMedia('(max-width: 1023px)')
  // Check if the media query is true
  if (mediaQuery.matches) {

    //  calculate height of any site banners
    
    let banners = document.getElementsByClassName("site-banner")
    let bannersHeight = 0 // Set an accumulator variable to `0`
    for (let i = 0; i < banners.length; i++) { // Loop through each element with the class "site-banner"
      bannersHeight += banners[i].offsetHeight // Add the height of the element to the accumulator variable (the total)
    }
    
    // Now set that as the pageWrapper margin
    const pageWrapper = document.querySelector(".pageWrapper")
    pageWrapper.style.marginBlockStart = bannersHeight + 'px'
  }
}
const button = document.querySelector('.banner__btn');
button.addEventListener('click', pageWrapperMargin); 

This isn’t working – without the function wrapping around and the event listener, the margin is correctly added (just not re-calculated on banner close).

How do I keep the state of collapsible vertical menu from one page to another in JavaScript?

I have been working on a collapsible vertical menu with Bootstrap 5 and JavaScript.

I needed to keep the vertical menu’s state – either collapsed or expanded – from one page to another.

For this purpose, I have used JavaScript’s sessionStorage, this way:

document.querySelector('.navbar-toggler').addEventListener("click", function(event) {
    event.preventDefault();
    if (Boolean(sessionStorage.getItem('sidebar-collapsed'))) {
        sessionStorage.setItem('sidebar-collapsed', '');
    } else {
        sessionStorage.setItem('sidebar-collapsed', '1');
    }
});

 document.addEventListener("DOMContentLoaded", function () {
     console.log(sessionStorage.getItem('sidebar-collapsed'))
    if(sessionStorage.getItem('sidebar-collapsed') == '1'){
        document.querySelector('.sidebar').classList.remove('show');
    } else {
        document.querySelector('.sidebar').classList.add('show');
    }
});

The problem I am faced with is that the menu is initialized as expanded and I need it collapsed initially.

Switching the if… else block in the click event function fails.

Where is my mistake?

Intercompany Purchase order to sales order [closed]

Is it possible create intercompany purchase order to sales order
give me the exact solution

I want to create intercompany purchase order to sales order but its having some error like this

but I give the purchase order number also
You must create a purchase order first to transfer intercompany inventory.

Error in Scheduled Script: You must create a purchase order first to transfer intercompany inventory.

How to stop redirecting users to wp-comments-post.php when receiving an error and display a popup instead

I have a website that allows comments on posts and reviews on woocommerce products.
However, the comment form, if not filled out correctly will automatically redirect users to /wp-comments-post.php to display the error. See image for error.

I want to display any errors like this in a simple popup alert box rather than users seeing WordPress error pages. What is the best way to implement this?

enter image description here

Symfony deserialize ManyToMany relation into existing objects

I have been trying to deserialize a JSON object with Doctrine ManyToMany relation.

The Categories are always new instances instead of existing objects. My hope is that someone here can show me how to recursively find the objects and replace them with existing objects (and merge the changes if needed ).

I want to use Symfony components and not a 3rd party library.

{
    id: 12,
    name: "360 Wallmount",
    categories: [
        {id: 15},
        {id: 12}
    ]
}

When deserialize the JSON above with Symfony deserializer

$entity = $this->serializerManager->deserialize($product, $request->getContent());

It does not replace the product categories with existing doctrine objects

Here is the Deserialize function

public function deserialize($entity, mixed $data, $groups = null)
{
    $context = [
        AbstractObjectNormalizer::DEEP_OBJECT_TO_POPULATE => true,
        AbstractNormalizer::OBJECT_TO_POPULATE => $entity,
        AbstractNormalizer::GROUPS => $groups
    ];

    return $this->serializer->deserialize($data, $entity::class, 'json', $context);
}

Efficiently Reusing an ORM Model’s Output Structure for Data from a Different Query (PHP ActiveRecord Example)

I’m working with a PHP framework that uses an ActiveRecord ORM (like Yii Framework or similar). I have a scenario where I need to query data from one or more tables (TableA, TableB) and present this data in an API response or view. However, the ideal structure for this output aligns with the field definitions of a specific model (CombinedModel), which isn’t directly mapped to the tables I’m querying.

The CombinedModel has a defined fields() method that specifies how its attributes should be structured for output (e.g., for API serialization). I want to leverage this existing structure without manually reshaping the data after fetching it with a different query.

What is an efficient and idiomatic way within an ActiveRecord ORM to execute a query that joins TableA and TableB, and then have the results formatted according to the fields() definition of CombinedModel?

I use a subquery in the from() clause. PHP:

$subQuery = TableA::find()
    ->select([
        'a_id' => 'table_a.id',
        'b_info' => 'table_b.info',
        // ... more required fields
    ])
    ->joinWith(['tableB'], true, 'INNER JOIN');

$query = CombinedModel::find()
    ->from(['combined_data' => $subQuery])
    ->joinWith(['tableA' => function ($q) {
        $q->on(['tableA.id' => 'combined_data.a_id']);
    }], true, 'INNER JOIN');

When I fetch results using $query->all() or with a DataProvider I hope the output will be structured according to CombinedModel’s fields().

This seems to work for fetching the data.

What are any potential drawbacks or alternative patterns I should consider within an ActiveRecord ORM to reuse a model’s output structure for data fetched through a different query?

Is this subquery approach generally considered good practice for this scenario?

What are more suitable ORM features or patterns?

What are performance implications?

How to upload multi-files in GPT APIs and make a conversation?

I have a web app built with Laravel that connects to the GPT APIs to let users chat with GPT. Now, I want to add a feature where users can upload up to 5 files and have a conversation based on those files. I read the GPT documentation, and while it explains how to upload files, it doesn’t clearly explain how to use those files in a conversation. When I upload a file, I get a file ID in response, but I’m not sure how to use that ID in the chat.

I need a way to dynamically edit the class of a div on one page from a script on another page [closed]

I have an ‘Availability Form’ on my site which allows users to select a date/time they desire to schedule an appointment.

I want to differentiate which dates/times are available (or not) within the Availability form, by using either of two separate CSS ‘class’ variables… ‘available’ or ‘unavailable’.

I’d like to be able to dynamically manage the Availability Form on the ‘Visitor’s Page’ using a mirrored structure on a ‘Manager’s Page’, by toggling the CSS class of a particular selection in the form between ‘avaiable’ or ‘unavailable’and saving the changes.

I am thinking a possible way to achieve this may be an ‘onclick’ javascript function?

But honestly, I am a bit out of my depth on this particular type of coding.
Any advice or help would be greatly appreciated.

I have included a simplified structure below (without any script).

CSS:

.pageContainer {

width: 100%;
max-width: 280px;
margin: auto;
align-items: center;

}

.dayContainer {

float: left;
padding: 10px;
width: 120px;
text-align: center;
margin-bottom: 40px;

}

h1 {

font-family: arial;
text-align: center;

}

.dayHeader {

color: #ffffff;
font-family: arial;
font-weight: bold;
cursor: pointer;
height: 40px; 
line-height: 40px;
background-color: black;    

}

.available {

width: 100%;
color: #ffffff;
font-family: arial;
cursor: pointer;
height: 40px; 
line-height: 40px;
background-color: green;

}

.available:hover {font-weight: bold;}

.unavailable  {

width: 100%;
color: #333333;
font-family: arial;
cursor: pointer;
height: 40px;
line-height: 40px;
background-color: grey;   

} 

.unavailable:hover {font-weight: bold;}

.buttonWrapper {

width:100%;
text-align: center;  

}

VISITOR’S PAGE (Availability Form):

<div class="pageContainer">

<h1>Visitor's Page</h1>

<form action="" method="post" name="availabilityForm">

<div class="dayContainer">
<div class="dayHeader">MONDAY</div>
<button id="VR1-C1" class="available">1:00 PM</button>
<button id="VR2-C1" class="unavailable">2:00 PM</button>
<button id="VR3-C1" class="available">3:00 PM</button>
</div>

<div class="dayContainer">
<div class="dayHeader">TUESDAY</div>
<button id="VR1-C2" class="unavailable">1:00 PM</button>
<button id="VR2-C2" class="available">2:00 PM</button>
<button id="VR3-C2" class="available">3:00 PM</button>
</div>

</form>

</div>

MANAGER’S PAGE

<div class="pageContainer">    

<h1>Manager's Page</h1>

<div class="dayContainer">
<div class="dayHeader">MONDAY</div>
<div id="MR1-C1" class="available" onclick="updateClass">1:00 PM</div>
<div id="MR2-C1" class="unavailable" onclick="updateClass">2:00 PM</div>
<div id="MR3-C1" class="available" onclick="updateClass">3:00 PM</div>
</div>


<div class="dayContainer">
<div class="dayHeader">TUESDAY</div>
<div id="MR1-C2" class="unavailable" onclick="updateClass">1:00 PM</div>
<div id="MR2-C2" class="available" onclick="updateClass">2:00 PM</div>
<div id="MR3-C2" class="available" onclick="updateClass">3:00 PM</div>
</div>

<br><br>

<div class="buttonWrapper"><button>Save Changes</button></div>

</div>

How to filter specified attribute Javascript object and get Javascript Object with the specified attribute value

const data = [
          { 
              "id": 'notes-jT-jjsyz61J8XKiI',
              "title": 'Welcome to Notes, Dimas!',
              "body": 'Welcome to Notes! This is your first note. You can archive it, delete it, or create new ones.',
              "createdAt": '2022-07-28T10:03:12.594Z',
              "archived": false,
          },
          { 
              "id": 'notes-aB-cdefg12345',
              "title": 'Meeting Agenda',
              "body": 'Discuss project updates and assign tasks for the upcoming week.',
              "createdAt": '2022-08-05T15:30:00.000Z',
              "archived": true,
          },
          { ...many more...}
        ] 

I have these kind of javascript object from public API, I want to filter object with the value true, so I could get 2 different data with object.archived==true and object.archived==false. How can I do that? I’ve been trying using filter and map method, both of it return undefined. How can I solve this?

Using MUI Palette Theme colors inside of Pie Chart does not work

I have a child component that returns a Pie chart

const coloredStats = [
        { id: 0, value: 5, label: 'Good tasks', color: 'success'},
        { id: 1, value: 4, label: 'Bad Tasks', color: 'error'} 
]

function MyPiechart(){
return (
  <PieChart
     series={[{
       data: coloredStats,
       innerRadius: 30,
       outerRadius: radius,               
       }, 
     ]}
  /> )}

The values success and error are taken from the default palette https://mui.com/material-ui/customization/palette/, I use them on my other components and I would like to use them on Pie Chart too due to my Parent component having a custom theme of which Im overriding the colors, and in case these color changes I would like to simply edit the ones in my theme instead of having to edit the hexcode inside of the piechart to match.

But instead of showing the colors like I expect them to I instead get the default color value, I know the theme is working since I already edited some values in the palette and they’re showing up correctly on my other components.

Is there a way to do it so that it follows the theme without manually writing the hex codes?

Swiper creativeEffect the same on scroll down and scroll up

I would like to reach exactly the same effect as: https://www.ysl.com/en-gb

I reached exactly effect which I want but only on scrolling down, but on scrolling up it works wrong. Result of my work you can see on: https://codesandbox.io/p/sandbox/swiper-mousewheel-control-forked-cyzyhd

I think that the problem is with creativeEffect, but after a lot of try I really don’t know how can I do that.

How to Implement Real-Time Audio I/O for Twilio Bidirectional Media Stream in React Native?

I created an app using React Native and a backend with Django. And I want to integrate a VOIP to GSM into the mobile app where users call GSM phones via my mobile app (internet), so I was looking into using Media Streams – WebSocket Messages where my current flow is that users make a request to my backend with a phone number to call, I initiate calling with Twilio with a URL to call if the user picks up, so the URL returns an XML that tells Twilio to connect to a bidirectional media stream with my WebSocket, so that is how audio will be sent to and from Twilio to make the project happen. But look at this: I am trying my best to make this project as clean, best practice, and real-time as possible, so actually I will be sending audio and microphone tracks via WebSocket in real-time, so is there any method or function that I can call to grab the microphone and send natively and an audio track to play too in real-time within this library used in conference implementation?

Nuxt 3 NuxtLink Not Redirecting Properly, Only Tags Work

I’m working on a Nuxt 3 project, and I’m experiencing an issue where NuxtLink components are not redirecting properly. Clicking on a NuxtLink does not navigate to the desired route, but using a classic tag works without any issues.

What I’ve Tried:

  1. Verified that the routes exist in the pages/ directory.
  2. I checked the browser console and found the following warnings:
[Warning] Timer "[nuxt-app] page:loading:start" already exists
[Warning] Timer "[nuxt-app] page:loading:end" already exists
  1. Disabled pageTransition in nuxt.config.ts:
    pageTransition: false
    This did not resolve the issue.
  2. Cleared the .nuxt directory and rebuilt the app:
rm -rf .nuxt
npm run dev
  1. Tested with a minimal example:
<template>
  <NuxtLink to="/about">Go to About</NuxtLink>
</template>

The issue persists.
Relevant Code:
Here’s my nuxt.config.ts file:

export default defineNuxtConfig({
  compatibilityDate: "2024-11-01",
  runtimeConfig: {
    public: {
      GOOGLE_ANALYTICS: process.env.GOOGLE_ANALYTICS,
      CHATWAY: process.env.CHATWAY,
    },
  },
  css: ["/assets/css/main.css", "primeicons/primeicons.css"],
  devtools: { enabled: true },
  debug: true,
  modules: [
    "nuxt-swiper",
    "@nuxtjs/tailwindcss",
    "@primevue/nuxt-module",
    "@nuxt/icon",
    "@nuxt/fonts",
  ],
  app: {
    baseURL: "/",
    buildAssetsDir: "/_nuxt/",
    head: {
      link: [
        {
          rel: "icon",
          type: "image/x-icon",
          href: "https://example.com/img/Favicon-2/height=100",
        },
      ],
      title: "Nuxt App",
      charset: "utf-16",
      viewport: "width=device-width, initial-scale=1, maximum-scale=1",
      htmlAttrs: {
        lang: "en",
      },
    },
    pageTransition: { name: "page", mode: "out-in" },
  },
  nitro: {
    output: {
      publicDir: "dist",
    },
  },
});

I am not using any custom middleware.
The issue occurs across all pages.
Using tags works fine, but I want to use NuxtLink for client-side navigation and better performance.

What could be causing NuxtLink to fail while tags work? How can I debug or fix this issue?