Skip to content

How to enable enquire.js for a drupal project #174

@webmasterpf

Description

@webmasterpf

Hi,

I've installed enquire .js in my project with:

$ npm install enquire.js
+ [email protected]

but nothing happen, so I would to know how to enable enquire.js for a drupal project ?

In Drupal8 there is many files that manage JS, I think libraries.yml could be the good one, but I can put the import command in a js file as well.

Is this the right command ?
import enquire from "enquire.js";

To test it I done this:

  jQuery(document).ready(function () {
    ////***** ENQUIRE.JS ****/////
    var desktop = "screen and (min-width:1200px)";// sortie=>> min-width: XXXpx xlarge 1200px
    var desktopwide = "screen and (min-width:1440px) and (min-resolution:1dppx)";
    //Utilisation d'enquire.js
    enquire.register(desktop, {
    	match : function() {
        console.log('Enquire.js : BP pour:'desktop);
        //Video sur HP
        /*$(".acces_rubriques iframe").each(function () {
            $(this).removeAttr('width');
            $(this).removeAttr('height');
            $(this).removeAttr('align');
        });*/
        $(".acces_rubriques iframe").height('95vh').width('60vw');//Video Gde Taille HP
    	},
    	unmatch : function() {
    		example.unmatch();
    	}
    });//enquire.register(desktop)
  });//Fin document.ready

Thanks for help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions