Questions tagged [requirejs]

Denotes questions related to require JS. RequireJS is a JavaScript file and module loader. It is optimized for in-browser use, but it can be used in other JavaScript environments.

Filter by
Sorted by
Tagged with
16
votes
1answer
9k views

Magento2: How can I override core js module price-box.js

I need to extend Magento_Catalog/js/price-box.js. I have used the 'mixins' feature, but it's not working for price-box.js. requirejs-config.js: var config = { config: { mixins: { ...
0
votes
2answers
950 views

_create function in custom require.js not called

I am creating a custom js for my module. app/code/Namespace/Module/view/frontend/requirejs-config.js var config = { map: { '*': { myjs:'Namespace_Module/js/myjs' } ...
0
votes
1answer
1k views

Can Not View Content Blocks due to require.js error - Magento 2 theme change

I am facing problem with require.js on Magento 2 theme change Content > Blocks The page shows endless spinner and I can never view my imported blocks for my new theme. When I do Firebug on the page. ...
1
vote
1answer
2k views

Replacing a default JS component

How do you replace a default JS component using requirejs in a custom theme? I have tried following the example at devdocs.magento.com but I can't seem to get it to work. To keep things simple I have ...
1
vote
1answer
490 views

Magento 2 does not read my requirejs-config.js

I'm customizing customer address tab in Admin Panel. Here is my code. It's reading my files but 'Add New Addresses' button is not responding. my code is: app/code/Learning/Helloworld/view/adminhtml/...
-1
votes
2answers
1k views

Javascript inclusion in Magento 2

I followed step by step this tutorial to include owl-carousel in Magento 2. http://www.boolfly.com/magento-2-slider-with-owl-carousel./ The problem is that I get this error: VM29879:1 Uncaught ...
1
vote
1answer
381 views

jQuery.easing[this.easing] for Magento2 Custom Theme

I am making a custom theme and for no reason at all, I am now getting : jQuery.easing[this.easing] I wasnt previously getting this. Any Ideas? Below is my requirejs config file: var config = { ...
2
votes
1answer
989 views

How to using instafeed in magento 2 with requirejs?

I create module to show instagram photos here my view->frontend : frontend--/ |layout--/ | cms_index_index.xml | default.xml | |templates--/ | instafeed.phtml |...
1
vote
3answers
2k views

Magento 2 - Replace existing Prototype JS with jQuery

default.xml <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/...
1
vote
2answers
1k views

Magento 2: How to Extend core js files or class or function?

I need to extend core js in my module or theme in this case how to do it, I can achieve it by keeping the complete file in my theme and do the changes, in this case, we will lose updates and if we ...
0
votes
1answer
414 views

jquery issue in custom module magento 2

i am on the way to create a custom module for sliding. But always its driving me crazy on jquery issues. Sometime the js will load and everything will be fine. After sometime, jquery wont get loaded. ...
3
votes
3answers
13k views

jquery not defined error in magento 2

I am trying to bring banner scroll in magento2. I am using owl carousel for this purpose. Everything have done and implemented and is showing in firefox without any errors. But when checked in chrome, ...
2
votes
2answers
209 views

JavaScript in Magento 2

How can I enable and use a custom JavaScript file in Magento 2? I have a theme.js file located at app/design/frontend/<Vendor>/<theme>/web/js and it depends on jQuery. Now I know there ...
7
votes
1answer
421 views

Replacing Core module javascript magento 2

I am replacing the core search module js by custom module using following code. var config = { map: { '*': { 'quickSearch':'All_Search/form-mini' } } }; when i ...
5
votes
2answers
16k views

Magento 2: How to defaultly open “content 2” tab?

I am using accordion for tab open and close.How to open default "content 2" tab? <div class="block filter" id="layered-filter-block" data-mage-init='{"collapsible":{"openedState": "active", "...
3
votes
1answer
3k views

Change order of JavaScript files in head

I add a custom JavaScript file with the following code: <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../...
12
votes
1answer
7k views

Requirejs shim option not working

I'm developing a module for Magento2 and I'm using requirejs to load custom javascript that depend on jquery. I'm using the shim option in requirejs-config.js to set this dependency between the custom ...
21
votes
4answers
22k views

Magento 2: requirejs-config.js in themes?

Is it possible to include a requirejs-config.js file (or otherwise configure RequireJS) via a Magento theme? Or is the capability reserved for Magento modules? The dev docs information on theme ...
19
votes
1answer
4k views

Why does Magento 2 use RequireJS `map` instead of `path`

In Magento 2's RequireJS implementation, many core modules use a configuration something like this map: { '*': { editTrigger: 'mage/edit-trigger', addClass: '...
8
votes
3answers
1k views

How/Where does Magento Convert a RequireJS module Name into a URL?

In Magento 2, you can use RequireJS to include a javascript module with code that looks something like this. #File: app/code/Package/Name/view/frontend/requirejs-config.js var config = { map: { ...
3
votes
3answers
7k views

Magento2: Add external JS globally

I'm trying to add external js in my module which will be applicable on all pages on frontend. This is the process I've followed: 1. Code in my layout file app/code/Lapisbard/General/view/frontend/...
1
vote
0answers
289 views

Magento 2 RequireJs callback not called

I have the following in requirejs-config.js var config = { "map": { "*": { "jquery/easing": "./js/jquery.easing.1.3", "jquery/mobile/customized": "./js/jquery....
1
vote
1answer
575 views

Use jQuery Plugins in Magento 2 blocks

I'm trying to use jQuery camera inside a page block, but I'm doing something wrong. I added the camera.min.js into my custom theme folder Theme_folder/Magento_Theme/web/js/camera.min.js Here's my ...
6
votes
1answer
3k views

Magento 2 - updating UI library javascript

How can i override default Mage 2 UI js functions? For example: I have setup accordion layered navigation to show/hide the filters in the sidebar (like the one in Luma theme). Default collapsible.js ...
17
votes
6answers
37k views

Magento2 not reading my requirejs-config.js

Hi I'm new to Magento2 and trying to figure out how RequireJS works in Magento. Here is my situation: I have following module: app/code/Mymodule/Test/view/frontend/requirejs-config.js Here is the ...
1
vote
2answers
2k views

get requirejs-config.js to load declared cdn's for jquery

I have been trying to get the requirejs-config.js to load, but as of yet it will not.. I have followed http://devdocs.magento.com/guides/v2.0/javascript-dev-guide/javascript/custom_js.html and put the ...
3
votes
2answers
4k views

How to extend js class/method of checkout model class in magento 2

Basically I need to some method overwrite/extend of following Js class. magento/module-checkout/view/frontend/web/js/model/step-navigator.js Overwrite of this class through requirejs working fine. ...
3
votes
3answers
271 views

Magento2 - SEO strength and SEO Architecture

I have just installed Magento2 EE and noticed that the Front-End is built upon the default template and the luna template. The page renders lots of ajax calls which get the html files of the ...
1
vote
3answers
1k views

Magento 2 script errors when running MAGE_MODE=production

I've installed Magento 2 and set MAGE_MODE=production. However, I'm receiving a lot of JavaScript errors when visiting the home page (requireJS). I tried flushing the cache and reploying static ...
8
votes
2answers
2k views

Add jQuery Datatables in magento 2

I am trying to use the jquery DataTables in magento-2 frontend using the requirejs. I can see the datables.min.js file in the net panel, but somehow it give the following error. My reuirejs-config....
3
votes
1answer
7k views

Magento 2: How to add popup on button click in admin?

Can you explain how to add popup(modal window) on button click in the adminhtml? I already create some phtml <div id="messages"> <div class="messages"> <?php foreach ($this->...
9
votes
2answers
33k views

How to load custom module js file in magento 2?

I have created banner slider module for magento 2. I have called JS file using following ways and its working fine. In block class I created following function public function getBaseJs($fileName){ ...
6
votes
2answers
7k views

Magento2 adding 3rd party jQuery files to module

I am trying to add in some 3rd party jQuery code to my Magento2 module. I want to have my own custom js file that will use the 3rd party code. Before I was adding the code into the header instead of ...
37
votes
3answers
61k views

Extending / Overriding JS in Magento 2

As Magento2 is using RequireJS for loading scripts, and there's no more skin folder, I've stuck with a problem: How can I replace Magento's module JS file by my modified version? For example — the ...

1
6 7 8 9
10