I am not familiar with JS at all and I was wondering how I can get this working in my Magento shop:
I apologise in advance if this is a stupid question.
I am not familiar with JS at all and I was wondering how I can get this working in my Magento shop:
I apologise in advance if this is a stupid question.
add the jquery library first then add your js code. also the $
variable is reserved for prototype in magento so you need to add noConflict()
<script>
jQuery.noConflict();
jQuery('#product_pop_before').delay(3000).fadeOut('slow', function(){
jQuery('#product_pop').fadeIn('slow');
jQuery('#product_pop').delay(4000).fadeOut(),
jQuery('#product_pop_before').delay(5000).fadeIn('slow');
});
</script>
$.noConflict is not a function
I added ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js
Commented
Jun 24, 2016 at 9:59
jQuery.noConflict();
Commented
Jun 24, 2016 at 10:01
<body>
tag
Commented
Jun 24, 2016 at 10:23
Just insert the code in the template you need and wrap it in <script type="text/javascript"></script>
Uncaught TypeError: Cannot read property 'delay' of null
Commented
Jun 24, 2016 at 9:39
Use below code:
<script>
jQuery.noConflict();
jQuery('#product_pop_before').delay(3000).fadeOut('slow', function(){
jQuery('#product_pop').fadeIn('slow');
jQuery('#product_pop').delay(4000).fadeOut(),
jQuery('#product_pop_before').delay(5000).fadeIn('slow');
});
</script>