-Magento_Catalog/layout/catalog_product_view.xml
and Magento_Catalog/templates/product/js.phtml
- Add new template to call our jQuery plugin. That helps us to include our js on product detail page only.
Magento_Catalog/layout/catalog_product_view.xml Magento_Catalog/templates/product/js.phtml
- Add new template to call our jQuery plugin. That helps us to include our js on product detail page only.
LayoutLayout
Template:Template:
-app/design/frontend/Boolfly/yume/web/js/custom.js
- We can create our own custom jQuery plugin.
app/design/frontend/Boolfly/yume/web/js/custom.js
define('jquery', function($) {
$.fn.HelloWorld = function() {
alert('Here');
}
}(jQuery)
);
We can create our own custom jQuery plugin.
define('jquery', function($) { $.fn.HelloWorld = function() { alert('Here'); } }(jQuery) );
app/design/frontend/Boolfly/yume/requirejs-config.js
Create a RequireJS configuration file.
var config = { map: { '*' : { 'hello' : 'js/custom' } } };
-app/design/frontend/Boolfly/yume/requirejs-config.js
- Create a RequireJS configuration file. Clear Magento Cache and run static content deploy:
var config = {
php bin/magento mapsetup: {
'*' static-content: {deploy
'hello' :php 'jsbin/custom'
}
magento }
};cache:clean
Clear Magento Cache and run static content deploy: php bin/magento setup:static-content:deploy