Menu icon Foundation
Joshua Scott about 3 years ago

How are you trying to use it? Can you provide us with your code?

Dimitris Gerasopoulos about 3 years ago

In order to use this javascript utility you must first initialize foundation



Joshua Scott about 3 years ago

Here is an example that shows using the Foundation.MediaQuery.current and also updating the value as the media query changes. Please see the comments in the code.

<!doctype html>
<html class="no-js" lang="en" dir="ltr">
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Media Query Test</title>
    <link rel="stylesheet" href="">
    <div id="status">Current Media Query <span class="mq"></span></div>
    <script src=""></script>
    <script src=""></script>

      <!-- Uses jQuery to set the initial value of the media query and write to the span -->

      $(window).on('changed.zf.mediaquery', function(event, newSize, oldSize) {
        <!-- detects changes from one media query to the next -->

        <!-- rewrites the value in span .mq to the current media query value -->