Responsive jQuery


/ Published in: jQuery
Save to your folder(s)

The basic structure of making a page responsive


Copy this code and paste it in your HTML
  1. $(window).resize(function(){
  2. if($(window).width() <= 641){
  3. $("div").css({'display': 'block'});
  4. $(".mainTitle").css({'display':'none'});
  5. $("#mainImg img").attr('src', "<?=$this->staticPath?>/img/mainTitleMob1.png");
  6. }else{
  7. $("#mainImg img").attr('src', "<?=$this->staticPath?>/img/phoneL.png");
  8. $(".mainTitle").css({'display':'block'});
  9. }
  10. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.