Javascript 移动兼容网站,不去。。移动宽度。。。。?

Javascript 移动兼容网站,不去。。移动宽度。。。。?,javascript,html,css,mobile,Javascript,Html,Css,Mobile,我试图在我的网站上实现移动可比性,我所有的容器都有一个最大宽度:1000px和a宽度:100%所以我的网站应该能够达到1000px,然后让达到100%,但这并没有发生。在电脑上是这样,但在手机上,这个网站显示为1000像素宽,所以我非常困惑 这里有一个,希望你们有一个想法 我会把我所有的代码都贴在这里,因为我觉得我必须 HTML JavaScript $(function() { // Get the form. var form = $('#ajax-contact');

我试图在我的网站上实现移动可比性,我所有的容器
都有一个
最大宽度:1000px和a
宽度:100%所以我的网站应该能够达到1000px,然后让
达到100%,但这并没有发生。在电脑上是这样,但在手机上,这个网站显示为1000像素宽,所以我非常困惑

这里有一个,希望你们有一个想法

我会把我所有的代码都贴在这里,因为我觉得我必须

HTML

JavaScript

$(function() {

    // Get the form.
    var form = $('#ajax-contact');

    // Get the messages div.
    var formMessages = $('#result');

    // Set up an event listener for the contact form.
    $(form).submit(function(e) {
        // Stop the browser from submitting the form.
        e.preventDefault();

        // Serialize the form data.
        var formData = $(form).serialize();

        // Submit the form using AJAX.
        $.ajax({
            type: 'POST',
            url: $(form).attr('action'),
            data: formData
        })
        .done(function(response) {
            // Make sure that the formMessages div has the 'success' class.
            $(formMessages).removeClass('error');
            $(formMessages).addClass('success');

            // Set the message text.
            $(formMessages).text(response);

            // Clear the form.
            $('#name').val('');
            $('#email').val('');
            $('#message').val('');
        })
        .fail(function(data) {
            // Make sure that the formMessages div has the 'error' class.
            $(formMessages).removeClass('success');
            $(formMessages).addClass('error');

            // Set the message text.
            if (data.responseText !== '') {
                $(formMessages).text(data.responseText);
            } else {
                $(formMessages).text('Oops! An error occured and your message could not be sent.');
            }
        });

    });

});
$(document).ready(function () {
          makebg(1);
});

$("#sotare").click(function(){
    $("#close_work").css({"display": "block"});
    $("#work_label").text( "Sotare" );
    $("#work_text").html( "I manipulated stylesheets to make the Sotare store match the wordpress theme my client had on his website.<br><br>What I did - Code." );
});
$("#hmf").click(function(){
    $("#close_work").css({"display": "block"});
    $("#work_label").text( "Hide my File" );
    $("#work_text").html( "A batch file I created for windows, I wanted to share so I made it a site.<br><br>What I did - Design and Code." );
});
$("#gravchimp").click(function(){
    $("#close_work").css({"display": "block"});
    $("#work_label").text( "Gravity Chimp" );
    $("#work_text").html( "An Android app I made, which is a part of the flappy idea.  I made it a website and it is soon to be released on iOS.<br><br>What I did - Design and Code." );
});
$("#trisearch").click(function(){
    $("#close_work").css({"display": "block"});
    $("#work_label").text( "TriSearching" );
    $("#work_text").html( "How about you, try searching with TriSearching!  It's a design of a search engine, and the results are swiped over, using Bing.<br><br>What I did - Design and Code." );
});
$("#close_work").click(function(){
    $("#close_work").css({"display": "none"});
    $("#work_label").text( "" );
    $("#work_text").html( "" );
});
var bgcolor = "white";
$("#ttt").click(function(){
    if(bgcolor == "white"){
        $("body").css({"background-color": "#009cff"});
        bgcolor = "blue";
    } else{ if(bgcolor == "blue"){
        $("body").css({"background-color": "#fff"});
        bgcolor = "white";
    }
          }
});

var currentpoly = 1;

$(window).scroll(function() {
    $("#polygons").css({
    'opacity' : 1-(($(this).scrollTop())/600)
    });          
}); 
function makebg(currentpoly){
    if(currentpoly < 31){
    var width = randomIntFromInterval(50,300);
    var height = width * 2;
    var rotation = randomIntFromInterval(1,360);
    var top = randomIntFromInterval(1,70);
    var left = randomIntFromInterval(10,90);
    var opacity = randomIntFromInterval(1,20);
    var range = randomIntFromInterval(10,60);
    $("#poly" + currentpoly).css({
        "width": width,
        "height": height,
        "-webkit-transform": "rotate(" + rotation + "deg)",
        "transform": "rotate(" + rotation + "deg)",
        "-ms-transform": "rotate(" + rotation + "deg)",
        "top": top + "%",
        "left": left + "%",
        "opacity": "." + opacity
    });

      $(document).ready(function () {

        var toggleStatus = 'small'
        setSmall()
        $.plax.enable()

        $("#range-small").click(function(){
          if(toggleStatus != 'small'){
            toggleRange()
          }
        })
        $("#range-big").click(function(){
          if(toggleStatus != 'big'){
            toggleRange()
          }
        })

        function toggleRange() {
          if(toggleStatus == 'small'){
            setBig()
          } else if (toggleStatus == 'big') {
            setSmall()
          } else {
            console.log(toggleStatus)
          }
          $("#range-big").toggleClass('active')
          $("#range-small").toggleClass('active')

          return false
        }
        function setSmall(){
        $("#poly" + currentpoly).plaxify({"xRange":range,"yRange":range});


          toggleStatus = 'small'
        }
      })



      currentpoly = currentpoly + 1;
    makebg(currentpoly);
    }
}
function randomIntFromInterval(min,max)
{
    return Math.floor(Math.random()*(max-min+1)+min);
}
$(函数(){
//去拿表格。
var form=$(“#ajax联系人”);
//获取消息div。
var formMessages=$(“#结果”);
//为联系人窗体设置事件侦听器。
$(表格)。提交(功能(e){
//停止浏览器提交表单。
e、 预防默认值();
//序列化表单数据。
var formData=$(form).serialize();
//使用AJAX提交表单。
$.ajax({
键入:“POST”,
url:$(form.attr('action'),
数据:formData
})
.完成(功能(响应){
//确保formMessages div具有“success”类。
$(formMessages).removeClass('error');
$(formMessages).addClass('success');
//设置消息文本。
$(formMessages)。文本(响应);
//清除表格。
$('#name').val('');
$('#email').val('');
$('#message').val('');
})
.失败(功能(数据){
//确保formMessages div具有“error”类。
$(formMessages).removeClass('success');
$(formMessages).addClass('error');
//设置消息文本。
如果(data.responseText!=''){
$(formMessages).text(data.responseText);
}否则{
$(formMessages).text('Oops!发生错误,无法发送您的邮件');
}
});
});
});
$(文档).ready(函数(){
makebg(1);
});
$(“#sotare”)。单击(函数(){
$(“#关闭工作”).css({“显示”:“块”});
$(“#工作标签”)。文本(“Sotare”);
$(“#work_text”).html(“我操纵样式表,使Sotare商店与我的客户在其网站上的wordpress主题匹配。

我所做的-代码”); }); $(“#hmf”)。单击(函数(){ $(“#关闭工作”).css({“显示”:“块”}); $(“#工作标签”).text(“隐藏我的文件”); $(“#work_text”).html(“我为windows创建的一个批处理文件,我想与大家共享,所以我把它做成了一个网站。

我所做的-设计和代码。”); }); $(“#gravchimp”)。单击(函数(){ $(“#关闭工作”).css({“显示”:“块”}); $(“工作标签”).text(“重力黑猩猩”); $(“#work_text”).html(“我制作的一款Android应用程序,它是flappy创意的一部分。我将它制作成一个网站,不久将在iOS上发布。

我所做的-设计和代码。”); }); $(“#trisearch”)。单击(函数(){ $(“#关闭工作”).css({“显示”:“块”}); $(“工作标签”).text(“三搜索”); $(“#工作文本”).html(“你呢,试试用Trisearch搜索吧!这是一个搜索引擎的设计,结果是用Bing浏览的。”

我做的-设计和编码。”); }); $(“#关闭#工作”)。单击(函数(){ $(“#关闭工作”).css({“显示”:“无”); $(“#工作标签”)。文本(“”); $(“#工作文本”).html(“”); }); var bgcolor=“白色”; $(“#ttt”)。单击(函数(){ 如果(bgcolor==“白色”){ $(“body”).css({“背景色”:“#009cff”}); bgcolor=“蓝色”; }else{if(bgcolor==“blue”){ $(“body”).css({“背景色”:“#fff”}); bgcolor=“白色”; } } }); var-currentpoly=1; $(窗口)。滚动(函数(){ $(“#多边形”).css({ “不透明度”:1-($(this.scrollTop())/600) }); }); 函数makebg(currentpoly){ 如果(当前多边形<31){ var宽度=随机整数间隔(50300); 变量高度=宽度*2; var rotation=randomIntFromInterval(1360); var top=randomIntFromInterval(1,70); var left=随机点FromInterval(10,90); var不透明度=randomIntFromInterval(1,20); var范围=randomIntFromInterval(10,60); $(“#poly”+currentpoly).css({ “宽度”:宽度, “高度”:高度, “-webkit变换”:“旋转(“+旋转+”度)”, “变换”:“旋转(“+旋转+”度)”, “-ms变换”:“旋转(“+旋转+”度)”, “顶部”:顶部+“%”, “左”:左+“%”, “不透明度”:“+”不透明度 }); $(文档).ready(函数(){ var-toggleStatus='small' setSmall() $.plax.enable() $(“#范围小”)。单击(函数(){ 如果(切换状态!=“小”){ 切换范围() } }) $(“#范围大”)。单击(函数(){ 如果(切换状态!=“大”){ 切换范围() } }) 函数toggleRange(){ 如果(toggleStatus==“小”){ setBig() }else if(toggleStatus=='big'){ setSmall() }否则{ console.log(切换状态) } $(“#范围大”).toggleClass('活动') $(“#范围小”).toggleClass('active') 返回错误 } 函数setSmall(){ $(“#poly”+currentpoly).plaxify({“xRange”:range,“yrrange”:range}); toggleStatus='small' } }) currentpoly=currentpoly+1; makebg(currentpoly); } } 函数randomIntFromInterval(最小值、最大值) { 返回Math.floor(Math.random()*(max-min+1)+min); }

请注意,我还没有让我的代码超级干净,因为我正在做它的中间,所以我的JS和其他代码将在未来更好,LOL。谢谢!p> 如果它在您的计算机上工作,但不在移动设备上,请确保您将视图端口设置在头部t内
::-moz-selection { /* Code for Firefox */
    color: #fff; 
    background: #000;
}
@font-face {
  font-family: 'allura';
  src: url('fonts/Allura.woff') format('woff'), /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
body {
   cursor: url(images/cursor/Normal%20Select.cur), auto;
    transition: background .5s;
    background-color: #fff;
}
p{
    cursor: url(images/cursor/Text%20Select.cur), auto;
}
h1{
    cursor: url(images/cursor/Text%20Select.cur), auto;
}
h2{
    cursor: url(images/cursor/Text%20Select.cur), auto;
}
h3{
    cursor: url(images/cursor/Text%20Select.cur), auto;
}
::-webkit-scrollbar{width: 5px;}
::-webkit-scrollbar-thumb {background-color:#000000;}
::-webkit-scrollbar-track {background-color:#FFFFFF;}

/* END CSS Code for Scrollbar END */
::selection {
    color: #fff; 
    background: #000;
}
.poly {
    background-image: url(images/svg/poly.svg);
    background-size: contain;
    background-repeat: no-repeat;
    height:200px;
    width:100px;
    position: absolute;
}


#section1content {
    position: absolute;
    top:30%;
    width:100%;
    text-align: center;
    transition: all 1s;
}

#section1 {
    width:100%;
    height:100%;
    position: fixed;
    z-index: 1;
    transition: all 1s;

}
.section {
    width:100%;
    position: relative;
    z-index: 2;
    background-color: #fff;
    font-family: 'Raleway', sans-serif;
}

#polygons {
    height:100%;
    width: 100%;
    position: fixed;;
    z-index: 0;
    top:0px;
    -webkit-animation: polyfade .5s; /* Chrome, Safari, Opera */ 
    animation: polyfade .5s;
}
/* Chrome, Safari, Opera */ 
@-webkit-keyframes polyfade {
    0%   {opacity: 0;}
    100% {opacity: 1;}
}

/* Standard syntax */
@keyframes polyfade {
    0%   {opacity: 0;}
    100% {opacity: 1;}
}

body {
    overflow-x: hidden;
}

#logoimg {
    -webkit-animation: logoimg 1s; /* Chrome, Safari, Opera */ 
    animation: logoimg 1s;
    width:298px;
    height:295px;
    margin-left:auto;
    margin-right: auto;
    border-radius: 50%;
    transition: all 1s;
    background-color: #fff;
    cursor: url(images/cursor/Link%20Select.cur), auto;
}
/* Chrome, Safari, Opera */ 
@-webkit-keyframes logoimg {
    0%   {opacity: 0}
    50%   {opacity: 0}
    100%   {opacity: 1}
}

/* Standard syntax */
@keyframes logoimg {
    0%   {top: 0px;}
    100% {top: 100px;}
}

#ttt {
    transition: all 1s;
}

#section2 {

}

.wrapper {
    width:100%;
    max-width: 1000px;
    padding-top: 50px;
    padding-bottom: 50px;
    margin-left: auto;
    margin-right: auto;
    border-bottom: #E0E0E0 solid 1px;
}

h1 {
    font-size: 35px;  
    font-weight: 700;
}
h3 {
    font-size: 30px;  
    font-weight: 700;
}

h2 {
    margin-left: 5px;
    color:#acacac;
}

p {
    margin-left: 8px;
    color: #727272;
    font-family: 'Lato', sans-serif;
}
a {
    transition: all .5s;
    color: #727272;
    border-bottom: #d8d8d8 2px solid;
    text-decoration: none;
    cursor: url(images/cursor/Link%20Select.cur), auto;
}
a:hover{
    color: #009cff;
}

#topspace {
    height:100%;
    width: 100%;
}

#logoimg:hover{
    background-color: #000;
}
svg:hover #ttt { fill: #fff; }


#quoteart {
    font-family: allura;
    font-size: 50px;
}

.quote_from {
    float:right;
}

.wrapper2 {
    width:100%;
    max-width: 1000px;
    padding-top: 50px;
    font-family: lato;
    font-weight: 300;
    margin-left: auto;
    margin-right: auto;
    font-size: 20px;
    text-align: center;
}



@-webkit-keyframes kaboom {
    from {margin-left: 0px;}
    to {margin-left: 50px;}
} 

/* Standard syntax */ 
@keyframes kaboom {
    from {background-color: #fa2424;}
    to {background-color: #fa2424;}
}

.workimg {
    cursor: url(images/cursor/Link%20Select.cur), auto;
    width:200px;
    height:auto;
    -webkit-filter: grayscale(1);
    filter: grayscale(1);
    transition: all .5s;
}
.workimg:hover {
    -webkit-filter: grayscale(0);
    filter: grayscale(0);
}

#close_work {
    display:none;
}
 .formfield {
margin-bottom: 30px;
}
 .formfield .col {
float: left;
width: 48.5%;
}
.formfield .col.second {
float: right;
}
.formfield .input-holder {
margin: 0px 0px;
}
input.text, #form-contact textarea {
height: 58px;
color: #7f8c8d;
font-family: Raleway;
font-size: 24px;
border: 1px solid #a5aeaf;
padding: 2px 20px 0px;
margin-left: -21px;
outline: none;
width: 100%;
}

#section4 {
    max-width:1392px;
}

#form-contact .formfield {
margin-bottom: 30px;
}

textarea {
    color: #7f8c8d;
    font-family: 'Raleway';
    padding: 20px;
    height: 150px;
    font-size: 14px;
    line-height: 18px;
    resize: none;
    border: 1px solid #a5aeaf;
    margin-left: -21px;
    outline: none;
    width: 100%;
    margin-top:30px;
}
#send-message {
width: 225px;
height: 50px;
background-color: #fff;
color: #a5aeaf;
font-family: 'Raleway';
font-size: 18px;
cursor: url(images/cursor/Link%20Select.cur), auto !important;
float: left;
border: 1px solid #a5aeaf;
-webkit-transition: all 200ms linear;
-o-transition: all 200ms linear;
-moz-transition: all 200ms linear;
transition: all 200ms linear;
}
#send-message:hover {
    color: #8f999a;
    border: 1px solid #8f999a;
}
#result {
font-size: 14px;
float: right;
color: #99a3a4;
margin-top: 18px;
text-transform: uppercase;
}
$(function() {

    // Get the form.
    var form = $('#ajax-contact');

    // Get the messages div.
    var formMessages = $('#result');

    // Set up an event listener for the contact form.
    $(form).submit(function(e) {
        // Stop the browser from submitting the form.
        e.preventDefault();

        // Serialize the form data.
        var formData = $(form).serialize();

        // Submit the form using AJAX.
        $.ajax({
            type: 'POST',
            url: $(form).attr('action'),
            data: formData
        })
        .done(function(response) {
            // Make sure that the formMessages div has the 'success' class.
            $(formMessages).removeClass('error');
            $(formMessages).addClass('success');

            // Set the message text.
            $(formMessages).text(response);

            // Clear the form.
            $('#name').val('');
            $('#email').val('');
            $('#message').val('');
        })
        .fail(function(data) {
            // Make sure that the formMessages div has the 'error' class.
            $(formMessages).removeClass('success');
            $(formMessages).addClass('error');

            // Set the message text.
            if (data.responseText !== '') {
                $(formMessages).text(data.responseText);
            } else {
                $(formMessages).text('Oops! An error occured and your message could not be sent.');
            }
        });

    });

});
$(document).ready(function () {
          makebg(1);
});

$("#sotare").click(function(){
    $("#close_work").css({"display": "block"});
    $("#work_label").text( "Sotare" );
    $("#work_text").html( "I manipulated stylesheets to make the Sotare store match the wordpress theme my client had on his website.<br><br>What I did - Code." );
});
$("#hmf").click(function(){
    $("#close_work").css({"display": "block"});
    $("#work_label").text( "Hide my File" );
    $("#work_text").html( "A batch file I created for windows, I wanted to share so I made it a site.<br><br>What I did - Design and Code." );
});
$("#gravchimp").click(function(){
    $("#close_work").css({"display": "block"});
    $("#work_label").text( "Gravity Chimp" );
    $("#work_text").html( "An Android app I made, which is a part of the flappy idea.  I made it a website and it is soon to be released on iOS.<br><br>What I did - Design and Code." );
});
$("#trisearch").click(function(){
    $("#close_work").css({"display": "block"});
    $("#work_label").text( "TriSearching" );
    $("#work_text").html( "How about you, try searching with TriSearching!  It's a design of a search engine, and the results are swiped over, using Bing.<br><br>What I did - Design and Code." );
});
$("#close_work").click(function(){
    $("#close_work").css({"display": "none"});
    $("#work_label").text( "" );
    $("#work_text").html( "" );
});
var bgcolor = "white";
$("#ttt").click(function(){
    if(bgcolor == "white"){
        $("body").css({"background-color": "#009cff"});
        bgcolor = "blue";
    } else{ if(bgcolor == "blue"){
        $("body").css({"background-color": "#fff"});
        bgcolor = "white";
    }
          }
});

var currentpoly = 1;

$(window).scroll(function() {
    $("#polygons").css({
    'opacity' : 1-(($(this).scrollTop())/600)
    });          
}); 
function makebg(currentpoly){
    if(currentpoly < 31){
    var width = randomIntFromInterval(50,300);
    var height = width * 2;
    var rotation = randomIntFromInterval(1,360);
    var top = randomIntFromInterval(1,70);
    var left = randomIntFromInterval(10,90);
    var opacity = randomIntFromInterval(1,20);
    var range = randomIntFromInterval(10,60);
    $("#poly" + currentpoly).css({
        "width": width,
        "height": height,
        "-webkit-transform": "rotate(" + rotation + "deg)",
        "transform": "rotate(" + rotation + "deg)",
        "-ms-transform": "rotate(" + rotation + "deg)",
        "top": top + "%",
        "left": left + "%",
        "opacity": "." + opacity
    });

      $(document).ready(function () {

        var toggleStatus = 'small'
        setSmall()
        $.plax.enable()

        $("#range-small").click(function(){
          if(toggleStatus != 'small'){
            toggleRange()
          }
        })
        $("#range-big").click(function(){
          if(toggleStatus != 'big'){
            toggleRange()
          }
        })

        function toggleRange() {
          if(toggleStatus == 'small'){
            setBig()
          } else if (toggleStatus == 'big') {
            setSmall()
          } else {
            console.log(toggleStatus)
          }
          $("#range-big").toggleClass('active')
          $("#range-small").toggleClass('active')

          return false
        }
        function setSmall(){
        $("#poly" + currentpoly).plaxify({"xRange":range,"yRange":range});


          toggleStatus = 'small'
        }
      })



      currentpoly = currentpoly + 1;
    makebg(currentpoly);
    }
}
function randomIntFromInterval(min,max)
{
    return Math.floor(Math.random()*(max-min+1)+min);
}
<meta name="viewport" content="width=device-width, initial-scale=1.0">