Skip to main content
Notice removed Authoritative reference needed by Manjunath
Bounty Ended with Jafar Pinjar's answer chosen by Manjunath
added 7 characters in body
Source Link
Manjunath
  • 177
  • 7
  • 31

I am creating zoom feature on images in my custom template,

app/code/Vendor/Module/view/frontend/requirejs-config.js

var config = {
 paths: {
        'custom_zoom': 'Vendor_Module/js/jquery.zoom.js'
 },
shim: {
    'custom_zoom': {
        deps: ['jquery']    
    }
 }
};

and in app/code/Vendor/Module/view/frontend/templates/custom.phtml

 <style>        
  .contain { 
    position: fixed; 
    right: 15%; 
    top: 15%; 
    width: 200px; 
    height: 220px; 
}       
</style>
<div><img class="imgsrc" src="image url here" /></div>

<div class="contain"></div> 

<script type="text/javascript">
require(['jquery', 'jquery/ui','custom_zoom'], function($){ 
$(document).ready(function(){
    $('.imgsrc') 
        .parent() 
        .zoom({ 
            magnify: 4, 
            target: $('.contain').get(0) 
        }); 
 }); 

Moved jquery.zoom.js into Vendor/Module/view/frontend/web/js directory

But I am getting this error in console in my custom page.

Script error for: custom_zoom

Can anyone help me on this please.. Thanks

I am creating zoom feature on images in my custom template,

app/code/Vendor/Module/view/frontend/requirejs-config.js

var config = {
 paths: {
        'custom_zoom': 'Vendor_Module/js/jquery.zoom.js'
 },
shim: {
    'custom_zoom': {
        deps: ['jquery']    
    }
 }
};

and in app/code/Vendor/Module/view/frontend/templates/custom.phtml

 <style>        
  .contain { 
    position: fixed; 
    right: 15%; 
    top: 15%; 
    width: 200px; 
    height: 220px; 
}       
</style>
<div><img class="imgsrc" src="image url here" /></div>

<div class="contain"></div> 

<script type="text/javascript">
require(['jquery', 'jquery/ui','custom_zoom'], function($){ 
$(document).ready(function(){
    $('.imgsrc') 
        .parent() 
        .zoom({ 
            magnify: 4, 
            target: $('.contain').get(0) 
        }); 
 }); 

Moved jquery.zoom.js into Vendor/Module/view/frontend/web/js directory

But I am getting this error in console in my custom page.

Script error for: custom_zoom

Can anyone help me on this please..

I am creating zoom feature on images in my custom template,

app/code/Vendor/Module/view/frontend/requirejs-config.js

var config = {
 paths: {
        'custom_zoom': 'Vendor_Module/js/jquery.zoom.js'
 },
shim: {
    'custom_zoom': {
        deps: ['jquery']    
    }
 }
};

and in app/code/Vendor/Module/view/frontend/templates/custom.phtml

 <style>        
  .contain { 
    position: fixed; 
    right: 15%; 
    top: 15%; 
    width: 200px; 
    height: 220px; 
}       
</style>
<div><img class="imgsrc" src="image url here" /></div>

<div class="contain"></div> 

<script type="text/javascript">
require(['jquery', 'jquery/ui','custom_zoom'], function($){ 
$(document).ready(function(){
    $('.imgsrc') 
        .parent() 
        .zoom({ 
            magnify: 4, 
            target: $('.contain').get(0) 
        }); 
 }); 

Moved jquery.zoom.js into Vendor/Module/view/frontend/web/js directory

But I am getting this error in console in my custom page.

Script error for: custom_zoom

Can anyone help me on this please.. Thanks

added 11 characters in body
Source Link
Manjunath
  • 177
  • 7
  • 31

I am creating zoom feature on images in my custom template,

app/code/Vendor/Module/view/frontend/requirejs-config.js

var config = {
 paths: {
        'custom_zoom': 'Vendor_Module/js/jquery.zoom.js'
 },
shim: {
    'custom_zoom': {
        deps: ['jquery']    
    }
 }
};

and in app/code/Vendor/Module/view/frontend/templates/custom.phtml

 <style>        
  .contain { 
    position: fixed; 
    right: 15%; 
    top: 15%; 
    width: 200px; 
    height: 220px; 
}       
</style>
<img<div><img class="imgsrc" src="image url here" />></div>

<div class="contain"></div> 

<script type="text/javascript">
require(['jquery', 'jquery/ui','custom_zoom'], function($){ 
$(document).ready(function(){
    $('.imgsrc') 
        .parent() 
        .zoom({ 
            magnify: 4, 
            target: $('.contain').get(0) 
        }); 
 }); 

Moved jquery.zoom.js into Vendor/Module/view/frontend/web/js directory

But I am getting this error in console in my custom page.

Script error for: custom_zoom

Can anyone help me on this please..

I am creating zoom feature on images in my custom template,

app/code/Vendor/Module/view/frontend/requirejs-config.js

var config = {
 paths: {
        'custom_zoom': 'Vendor_Module/js/jquery.zoom.js'
 },
shim: {
    'custom_zoom': {
        deps: ['jquery']    
    }
 }
};

and in app/code/Vendor/Module/view/frontend/templates/custom.phtml

 <style>        
  .contain { 
    position: fixed; 
    right: 15%; 
    top: 15%; 
    width: 200px; 
    height: 220px; 
}       
</style>
<img class="imgsrc" src="image url here" />

<div class="contain"></div> 

<script type="text/javascript">
require(['jquery', 'jquery/ui','custom_zoom'], function($){ 
$(document).ready(function(){
    $('.imgsrc') 
        .parent() 
        .zoom({ 
            magnify: 4, 
            target: $('.contain').get(0) 
        }); 
 }); 

Moved jquery.zoom.js into Vendor/Module/view/frontend/web/js directory

But I am getting this error in console in my custom page.

Script error for: custom_zoom

Can anyone help me on this please..

I am creating zoom feature on images in my custom template,

app/code/Vendor/Module/view/frontend/requirejs-config.js

var config = {
 paths: {
        'custom_zoom': 'Vendor_Module/js/jquery.zoom.js'
 },
shim: {
    'custom_zoom': {
        deps: ['jquery']    
    }
 }
};

and in app/code/Vendor/Module/view/frontend/templates/custom.phtml

 <style>        
  .contain { 
    position: fixed; 
    right: 15%; 
    top: 15%; 
    width: 200px; 
    height: 220px; 
}       
</style>
<div><img class="imgsrc" src="image url here" /></div>

<div class="contain"></div> 

<script type="text/javascript">
require(['jquery', 'jquery/ui','custom_zoom'], function($){ 
$(document).ready(function(){
    $('.imgsrc') 
        .parent() 
        .zoom({ 
            magnify: 4, 
            target: $('.contain').get(0) 
        }); 
 }); 

Moved jquery.zoom.js into Vendor/Module/view/frontend/web/js directory

But I am getting this error in console in my custom page.

Script error for: custom_zoom

Can anyone help me on this please..

added 10 characters in body
Source Link
Manjunath
  • 177
  • 7
  • 31

script error while including Enable zoom feature in custom jstemplate in Magento 2

I am creating zoom feature on images in my custom template,

app/code/Vendor/Module/view/frontend/requirejs-config.js

var config = {
 paths: {
        'custom_zoom': 'Vendor_Module/js/jquery.zoom.js'
 },
shim: {
    'custom_zoom': {
        deps: ['jquery']    
    }
 }
};

and in app/code/Vendor/Module/view/frontend/templates/custom.phtml

 <style>        
  .contain { 
    position: fixed; 
    right: 15%; 
    top: 15%; 
    width: 200px; 
    height: 220px; 
}       
</style>
<img class="imgsrc" src="image url here" />

<div class="contain"></div> 

<script type="text/javascript">
require(['jquery', 'jquery/ui','custom_zoom'], function($){ 
$(document).ready(function(){
    $('.imgsrc') 
        .parent() 
        .zoom({ 
            magnify: 4, 
            target: $('.contain').get(0) 
        }); 
 }); 

Moved jquery.zoom.js into Vendor/Module/view/frontend/web/js directory

But I am getting this error in console in my custom page.

Script error for: custom_zoom

Can anyone help me on this please..

script error while including custom js Magento 2

I am creating zoom feature in my custom template,

app/code/Vendor/Module/view/frontend/requirejs-config.js

var config = {
 paths: {
        'custom_zoom': 'Vendor_Module/js/jquery.zoom.js'
 },
shim: {
    'custom_zoom': {
        deps: ['jquery']    
    }
 }
};

and in app/code/Vendor/Module/view/frontend/templates/custom.phtml

 <style>        
  .contain { 
    position: fixed; 
    right: 15%; 
    top: 15%; 
    width: 200px; 
    height: 220px; 
}       
</style>
<img class="imgsrc" src="image url here" />

<div class="contain"></div> 

<script type="text/javascript">
require(['jquery', 'jquery/ui','custom_zoom'], function($){ 
$(document).ready(function(){
    $('.imgsrc') 
        .parent() 
        .zoom({ 
            magnify: 4, 
            target: $('.contain').get(0) 
        }); 
 }); 

Moved jquery.zoom.js into Vendor/Module/view/frontend/web/js directory

But I am getting this error in console in my custom page.

Script error for: custom_zoom

Can anyone help me on this please..

Enable zoom feature in custom template in Magento 2

I am creating zoom feature on images in my custom template,

app/code/Vendor/Module/view/frontend/requirejs-config.js

var config = {
 paths: {
        'custom_zoom': 'Vendor_Module/js/jquery.zoom.js'
 },
shim: {
    'custom_zoom': {
        deps: ['jquery']    
    }
 }
};

and in app/code/Vendor/Module/view/frontend/templates/custom.phtml

 <style>        
  .contain { 
    position: fixed; 
    right: 15%; 
    top: 15%; 
    width: 200px; 
    height: 220px; 
}       
</style>
<img class="imgsrc" src="image url here" />

<div class="contain"></div> 

<script type="text/javascript">
require(['jquery', 'jquery/ui','custom_zoom'], function($){ 
$(document).ready(function(){
    $('.imgsrc') 
        .parent() 
        .zoom({ 
            magnify: 4, 
            target: $('.contain').get(0) 
        }); 
 }); 

Moved jquery.zoom.js into Vendor/Module/view/frontend/web/js directory

But I am getting this error in console in my custom page.

Script error for: custom_zoom

Can anyone help me on this please..

Notice added Authoritative reference needed by Manjunath
Bounty Started worth 50 reputation by Manjunath
edited title
Link
Manjunath
  • 177
  • 7
  • 31
Loading
added 7 characters in body
Source Link
Manjunath
  • 177
  • 7
  • 31
Loading
added 626 characters in body; edited tags; edited title
Source Link
Manjunath
  • 177
  • 7
  • 31
Loading
added 19 characters in body
Source Link
Manjunath
  • 177
  • 7
  • 31
Loading
added 13 characters in body
Source Link
Manjunath
  • 177
  • 7
  • 31
Loading
Source Link
Manjunath
  • 177
  • 7
  • 31
Loading