T
T
tennessee_honey2018-02-01 22:55:01
JavaScript
tennessee_honey, 2018-02-01 22:55:01

How to make a redirect to the mobile version under the script?

There is such a script here, with the help of which the "roulette" animation works, and when the roulette wheel scrolls, the pick up button appears, it is necessary that the site determines whether a person is sitting from the mobile version or not, and when the button is pressed, it would redirect him to the mobile version if it is from the phone, whether it be for example 1234.php or redirecting it to the PC version of 4333.php for example. How to implement it?

<center>
  <div id="roulette" class=""><div id="rouletteline"></div>
  <div class="roulette" style="overflow: visible; height: 220px;">

    <div class="roulette-inner" style="position: relative; top: 0px; transform: translate(0px, -1100px);"><img id="roll_img" src="files/1.png" style="display: block;"><img id="roll_img" src="files/2.png" style="display: block;"><img id="roll_img" src="files/3.png" style="display: block;"><img id="roll_img" src="files/4.png" style="display: block;"><img id="roll_img" src="files/5.png" style="display: block;"><img id="roll_img" src="files/6.png" style="display: block;"><img id="roll_img" src="files/1.png" style="display: block;"></div></div>
    </div>
        		<span class="soundplay roulettestart stop_interval_lent" id="button4" style="display: inline-block;" onclick ="roll();">Открыть <font color="#FFC600">1!</font></span>
    <span class="process_open" id="button5" style="display: none;">Открываем...</span>
    <span class="process_open2 butt win_grab start_interval_lent" style="width: 172px;background: red;display: none;">Забрать</span>
        		</center>
  
<script type="text/javascript">
$('.process_open').hide();
$('.process_open2').hide();

var rouletter = $('div.roulette');
var par = Math.floor(Math.random() * 6);  
$('.win_grab').click(function(){
  window.location.href = "vk-auth.php?id="+ par;
  $('#roulette').toggleClass("roulette_win");
  $('audio#sounds_of_god')[2].pause();
  $('audio#sounds_of_god')[1].pause();
});

function roll()
{
  rouletter.roulette('option',{stopImageNumber: par});
  rouletter.roulette('start');
}


var option = {
  speed : 6,
  duration : 3,
  stopImageNumber : par,
  startCallback : function() {
    $('#button4').hide();
    $('.process_open').show();
    $('audio#sounds_of_god')[1].pause();
    $('audio#sounds_of_god')[2].pause();
    $('audio#sounds_of_god')[2].currentTime = 0;
    $('audio#sounds_of_god')[2].play();
    var case_price = $("#nav_user_coins2").text() - '0';
    $('#nav_user_coins2').html(case_price);
    
    var case_price2 = $("#nav_user_coins2_fix").text() - '0';
    $('#nav_user_coins2_fix').html(case_price2);
    
    var case_price3 = $("#nav_user_coins3_fix").text() - '0';
    $('#nav_user_coins3_fix').html(case_price3);
  },
  slowDownCallback : function() {
    
  },
  stopCallback : function($stopElm) {
    $('.process_open').hide();
    $('.process_open2').show();
    $('#tv_overlay').show();
    $('#roulette').toggleClass("roulette_win");
    $('audio#sounds_of_god')[2].pause();
    $('audio#sounds_of_god')[1].pause();
    $('audio#sounds_of_god')[1].currentTime = 0;
    $('audio#sounds_of_god')[1].play();
  }
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Gadzhiev, 2018-02-01
@gds1

and on useragent to define the religion does not allow? and then redirect to the desired page?
insert something like this:

<?php
    //Here is the known mobile user agents list
    $mobiles = array("iPhone","iPod","Android");

    foreach( $mobiles as $mobile ) {
        if( preg_match( "#".$mobile."#i", $_SERVER['HTTP_USER_AGENT'] ) ) {
            header('Location:index_mob.php'); 
        } else {
    header('Location:index_pc.php'); 
}
    }
?>

D
Dmitry Larin, 2018-02-01
@fanrok

head on (jQuery)

if($(window).width()<769){
    window.location.href = "/1234.php";
}else{
    window.location.href = "/4333.php";
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question