PC와 mobile에서 다르게 출력하기 질문입니다.

PC와 mobile에서 다르게 출력하기 질문입니다.

QA

PC와 mobile에서 다르게 출력하기 질문입니다.

본문

INDEX    

<?php if($is_mobile){ ?>
    <a href="#" class="back_to_top_mobile"><img class="buttonhover" src="/../../images/upbutton.png"></a>
    <?php } else { ?>
        
    <a href="#" class="back_to_top"><img class="buttonhover" src="/../../images/upbutton.png"></a>
<?php } ?>

 

 

 

JS

        var offset = 220;  
    var duration = 500;  
    jQuery(window).scroll(function() {  
        if (jQuery(this).scrollTop() > offset) {  
            jQuery('.back_to_top').fadeIn(duration);  
        } else {  
            jQuery('.back_to_top').fadeOut(duration);  
        }  
    });  
      
      
    jQuery('.back_to_top,.back_to_top_mobile').click(function(event) {  
        event.preventDefault();  
        jQuery('html, body').animate({scrollTop: 0}, duration);  
        return false;  
    })  

        jQuery('.back_to_top,.back_to_top_mobile').on('mouseenter', function() { 
        $(this).find('img').attr('src','/../../images/upbuttonhover.png');
       })
        jQuery('.back_to_top,.back_to_top_mobile').on('mouseleave', function() { 
        $(this).find('img').attr('src','/../../images/upbutton.png');
       })

 

 

CSS

.back_to_top{position:fixed;bottom:0;left:50%; margin-left:500px; margin-bottom:10px;}  
 
.back_to_top img:hover{background-image:url(/../../images/upbuttonhover.png) left center} 

.back_to_top_mobile{position:fixed;bottom:0; right:0; margin-bottom:10px;}  
 
.back_to_top_mobile img:hover{background-image:url(/../../images/upbuttonhover.png) left center} 

 

왜 적용이 안되는거죠?

 

PC는 적용이 되지만 모바일은 안되고 있습니다.

이 질문에 댓글 쓰기 :

답변 2

$is_mobile 함수가 로그되는지부터 확인해보세요.

만약 로드되지 않는다면 글로벌로 땡겨서 쓰시구요

<?php global $is_mobile; ?>

답변을 작성하시기 전에 로그인 해주세요.
전체 168
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT