For example, there is such a code:

$(document).ready(function(){ var cur_width = $(window).width(); $(window).resize(function(){ if($(window).width() <= 720 && cur_width > 720){ //reload location.reload(); } else if($(window).width() > 720 && cur_width <= 720){ //reload location.reload(); } }); }); 

How to output html instead of reloading in this code?

  • or rather, I want to place the code in tpl on smarty. In one condition, I need a download like this: {block name = 'product_images_modal'} {include file = 'catalog / 1.tpl'} {/ block}, in the other: {block name = 'product_images_modal'} {include file = 'catalog /2.tpl'ment //block} - Vladimir Rodichev

1 answer 1

 var cur_width = $(window).width(); $(window).resize(function(){ if($(window).width() <= 720 && cur_width > 720){ document.body.innerHTML = 'SomeData'; } else if($(window).width() > 720 && cur_width <= 720){ document.body.innerHTML = 'SomeOtherData'; } }); 
  • something is not working. - Vladimir Rodichev 1:43 pm
  • And a little more specific behavior? just does not work and there are no mistakes?) - Vladimir Klykov
  • Nothing at all. I did not specify one detail, the script is placed in * .tpl on smarty, in this topic I made a clarification: - Vladimir Rodichev