# RadzenMediaQuery with javascript event callback for static page

**URL:** <https://forum.radzen.com/t/radzenmediaquery-with-javascript-event-callback-for-static-page/15625>\
**Category:** Radzen.Blazor Components\
**Created:** [November 5, 2023, 3:56pm UTC](https://forum.radzen.com/t/radzenmediaquery-with-javascript-event-callback-for-static-page/15625 "2023-11-05T15:56:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheRHogue](https://forum.radzen.com/letter_avatar_proxy/v4/letter/t/a587f6/32.png) [@TheRHogue](https://forum.radzen.com/u/TheRHogue)\
**Post date:** [November 5, 2023, 3:56pm UTC](https://forum.radzen.com/t/radzenmediaquery-with-javascript-event-callback-for-static-page/15625/1 "2023-11-05T15:56:40Z")

</div>

Is there a way to add a javascript callback for the "change" event in the RadzenMediaQuery?

For example, in the code snippet below, can the "@OnResponsiveBreak" callback be moved from the @code section into the "script" section?

The reason is we have .net 8 static render pages, and we want to get events but it will need to be in the "script" section as @Code will not run. It could be that the IJSRuntime injection scenario doesn't work in "static" render mode, and trying to intermingle will not work, but I wanted to ask the question.

```auto
<RadzenMediaQuery Query="(max-width: 767.98px)" Change=@OnResponsiveBreak />

<script>
    How can the callback from RadzenMediaQuery be here instead?
</script>

@code {
    private void OnResponsiveBreak(bool matches)
    {
   
        StateHasChanged();
    }

   
}

```

thanks  
Rob  
Radzen Blazor Studio Professional owner

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [November 5, 2023, 5:11pm UTC](https://forum.radzen.com/t/radzenmediaquery-with-javascript-event-callback-for-static-page/15625/2 "2023-11-05T17:11:34Z")

</div>

As you know Blazor events are not raised in static rendering mode. This is by design and there is no way around that except of using a different rendering mode.

If you want to run JavaScript when a media query changes you can use just JavaScript. Check the relevant [JS API's](https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/change_event).
