samedi 25 juin 2016

Basically i want to run an html code if a condition is met

Basically i want to run an html code if the user use a mobile device. When I tried doing this it didn't work (probably because I'm running the html within JS tags.

<!--device detection-->
    <script type="text/javascript">
    if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|OperaMini/i.test(navigator.userAgent) ) {

        document.write('line1'+
           'line2'+
           'line3'+
           'line4'+
           'line5'+
           'line6'+
           'line7'+
           'line8'+
           'line9'+
           'line10'+);
        <!-- start of nivo. slider code-->
         <!-- here i called the slider-->
        <div id="slider">
        <a href="">
            <img src="../images/banner_01.jpg" alt="" title= "" /></a>
            <img src="../images/banner_02.jpg" alt="" title="" /></a> 
            <img src="../images/banner_03.jpg" alt="" title="" /></a> 
            <img src="../images/banner_04.jpg" alt="" title="" /></a> 
        </div>
        <!-- end of nivo. slider code-->

    }
    </script

Aucun commentaire:

Enregistrer un commentaire