抖音很火的召唤神龙的小游戏完整代码-召唤神龙

2023-11-16

抖音很火的解压小游戏,完整代码分享。有兴趣的可以试着写一下。

 

1.  index

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">

  <title>召唤神龙</title>

  <!--http://www.html5rocks.com/en/mobile/mobifying/-->
  <meta name="viewport"
        content="width=device-width,user-scalable=no,initial-scale=1, minimum-scale=1,maximum-scale=1"/>

  <!--https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html-->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  <meta name="format-detection" content="telephone=no">

  <!-- force webkit on 360 -->
  <meta name="renderer" content="webkit"/>
  <meta name="force-rendering" content="webkit"/>
  <!-- force edge on IE -->
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
  <meta name="msapplication-tap-highlight" content="no">

  <!-- force full screen on some browser -->
  <meta name="full-screen" content="yes"/>
  <meta name="x5-fullscreen" content="true"/>
  <meta name="360-fullscreen" content="true"/>
  
  <!-- force screen orientation on some browser -->
  <meta name="screen-orientation" content=""/>
  <meta name="x5-orientation" content="">

  <!--fix fireball/issues/3568 -->
  <!--<meta name="browsermode" content="application">-->
  <meta name="x5-page-mode" content="app">

  <!--<link rel="apple-touch-icon" href=".png" />-->
  <!--<link rel="apple-touch-icon-precomposed" href=".png" />-->
  
  
    <!-- <script>
        pushHistory();
        window.addEventListener("popstate", function(e) {

        }, false);
        function pushHistory() {
            var state = {
                title: "",
                url: window.location.href
            };
            window.history.pushState(state, state.title, state.url);
        }
    </script> -->

  <link rel="stylesheet" type="text/css" href="style-mobile.css"/>

</head>
<!-- <body style="margin: 0; background: #ddd;" align="center"> -->
  <div style="align:center;display: none"><img src="res/share.png" width="10%" /></div>
  
  <!-- <div id="canvasDiv" style="width:100%;height:100%;">
  </div>  -->
  <canvas id="GameCanvas" oncontextmenu="event.preventDefault()" tabindex="0" ></canvas>

  <video id="contentElement" style = "display:none;position: absolute;top:0px;left: 0px;">
            <!-- <source src="http://rmcdn.2mdn.net/Demo/vast_inspector/android.mp4"></source>
            <source src="http://rmcdn.2mdn.net/Demo/vast_inspector/android.webm"></source> -->
  </video> 
  <div id="block-Box" style="display:block;width:100%;height:100%;"></div>
  
  

 <div id="adContainer" style="display:none;position: absolute;top:0px;left: 0px;width:100%;height:100%;z-index:999;"></div> 
 <div id="loadingText"
 style="width:100%;display: none;text-align:center;position:absolute;top:45%;z-index:2;font-size:20px;color:#f99f0a">
 loading......0%
</div>
	
	 <div id="splash">
      <!-- <div class="progress-bar stripes"> -->
        <!-- <span style="width: 0%"></span> -->
      <!-- </div> -->
   </div>

   <div id="loadingImg" style="top:45%;width: 100%;position:absolute; ">
    <img src="res/loading.gif" width="7%" height="7%" />
  </div>
  
     <!-- 判断浏览器是否屏蔽广告 -->
  <script src="http://demo.jb51.net/js/2015/adview_pic_cpc_cpm_cpa_guanggao_gg_ads_300x250.js" type="text/javascript"></script> 
	<script type="text/javascript">
	
	 var killAdT = typeof(killads);
		// <!-- if (typeof(killads)=='undefined'){ -->
		// 	<!-- alert('广告被过滤'); -->
		// 	<!-- } -->
	</script>
   
  
  
  
<!--<div align="center" style="font-size: 10px;color: dimgrey">advertisement</div>-->

<script type="text/javascript" src="//imasdk.googleapis.com/js/sdkloader/ima3.js"></script>
<script type="text/javascript" src="ads.js"></script>

<script src="src/settings.js" charset="utf-8"></script>

<script type="text/javascript">

	var preloader;
    var adCompleteFlag = false;
    var resCompleteFlag = false;

    var adEndComplete = false;
    var resEndComplete = false;
	
	judgeLanTitle();
    function judgeLanTitle(){

//        console.log("window.navigator.language",window.navigator.language);

        if( window.navigator.language=="zh-CN" ||window.navigator.language=="zh-cn"){
            document.title = "召唤神龙";
        }else  if(window.navigator.language == "zh-TW" ){
            document.title = "召喚神龍";
        }else  if(window.navigator.language == "zh-HK" ){
            document.title = "召喚神龍";
        }else  if(window.navigator.language == "ko-KR"){
            document.title = "신용 소환";
        }else  if(window.navigator.language == "ja-JP"){
            document.title = "神竜を召喚する";
        }else  if(window.navigator.language == "th-TH"){
            document.title = "เรียกมังกร";
        }else{
            document.title = "Summon the Dragon";
        }
    }

    var loadintT = document.getElementById("loadingText");
    var loadintGif = document.getElementById("loadingImg")
    setTimeout(function () {
      loadintGif.remove();
      loadintT.style.display = ""
      updateLabView(0.1);
    }, 1 * 1000)

    window.timer = null;
    window.tempSeconds = 1;
    window.loadData = {};
    loadData.completedCount = 0;
    loadData.totalCount = 0;

  onload();
 function onload()  {
       var winHeight = document.documentElement.clientHeight;
       document.getElementById("canvasDiv").style.height = winHeight+"px";
  }; 
 window.onload =function() {
       document.getElementById("block-Box").style.display = "none";
 }

 function updateLabView(t) {
      if (timer != null) {
        clearInterval(timer);
      }
      timer = setInterval(function () {
        tempSeconds++;
        actualTotal();
        var loadintT = document.getElementById("loadingText")
        if(!loadintT){
          // clearInterval(timer);
          return;
        }

        loadintT.innerHTML = 'loading......' + parseInt(tempSeconds) + '%';

        switch (tempSeconds) {
          case 20:
            updateLabView(0.2);
            break;
          case 40:
            updateLabView(0.3);
            break;
          case 60:
            updateLabView(0.4);
            break;
          case 96:
            updateLabView(5);
            break;
          case 97:
            updateLabView(10);
            break;
          case 98:
            updateLabView(50);
            break;
          case 99:
            updateLabView(100);
            break;
          default:
            if (tempSeconds >= 80 && tempSeconds < 96) {
              updateLabView(t + 0.1);
            }
            break;
        }
        if (tempSeconds > 100) {
          clearInterval(timer);
          tempSeconds = 100
          loadintT.innerHTML = 'loading......' + parseInt(tempSeconds) + '%';
        }
      }, t * 1000);
    }

    function actualTotal() {
      var percent = parseInt(100 * loadData.completedCount / loadData.totalCount);
      if (percent > tempSeconds && loadData.totalCount > 1) {
        tempSeconds = percent;
      }
    }

    function finishLoad(){
      clearInterval(timer); 
      loadintT.innerHTML = 'loading......100' + '%';
      setTimeout(function(){
        loadintT.remove();
      },0.1 * 1000);
    }
</script>
  
  
  
  
  
<script src="src/settings.js" charset="utf-8"></script>

<script src="main.js" charset="utf-8"></script>


<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- 水工厂 -->
<!-- <ins class="adsbygoogle"
      style="position:absolute;border-top:5px #f0f0f1 solid;background:#f0f0f1;bottom:0px;z-index:1000;display:inline-block;min-width:320px;max-width:970px;width:100%;height:60px"
     data-ad-client="ca-pub-3932234672445376"
     data-ad-slot="1751302463"></ins>

<script>
      var ads = document.getElementsByClassName('adsbygoogle')[0];
      if (document.body.clientHeight > 700){
          ads.style.height = 80+'px';
      }else{
          ads.style.height = 60+'px';
      }
</script>

<script>
    function ShowBannerAD(){
      (adsbygoogle = window.adsbygoogle || []).push({});
    }
</script> -->
<!-- 果盘合合 -->
<script async
        data-ad-client="ca-pub-3932234672445376"
        data-ad-channel="1828757928"
		    data-ad-frequency-hint="15s"
        src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js">
</script>

<script>window.adsbygoogle = window.adsbygoogle || [];
const adBreak =  function(o) {adsbygoogle.push(o);}
</script>


<script type="text/javascript">

(function () {
    // open web debugger console
    if (typeof VConsole !== 'undefined') {
        window.vConsole = new VConsole();
    }

    var debug = window._CCSettings.debug;
    var splash = document.getElementById('splash');
    splash.style.display = 'block';

    function loadScript (moduleName, cb) {
      function scriptLoaded () {
          document.body.removeChild(domScript);
          domScript.removeEventListener('load', scriptLoaded, false);
          cb && cb();
      };
      var domScript = document.createElement('script');
      domScript.async = true;
      domScript.src = moduleName;
      domScript.addEventListener('load', scriptLoaded, false);
      document.body.appendChild(domScript);
    }

    loadScript(debug ? 'cocos2d-js.js' : 'cocos2d-js-min.js', function () {
      if (CC_PHYSICS_BUILTIN || CC_PHYSICS_CANNON) {
        loadScript(debug ? 'physics.js' : 'physics-min.js', window.boot);
      }
      else {
        window.boot();
      }
    });
})();


</script>
</body>
</html>

2. ads.js

var videoContent = document.getElementById('contentElement');

var adDisplayContainer =
    new google.ima.AdDisplayContainer(
        document.getElementById('adContainer'),
        videoContent);
// Must be done as the result of a user action on mobile
adDisplayContainer.initialize();

// Re-use this AdsLoader instance for the entire lifecycle of your page.
var adsLoader = new google.ima.AdsLoader(adDisplayContainer);

// Add event listeners
adsLoader.addEventListener(
    google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
    onAdsManagerLoaded,
    false);
adsLoader.addEventListener(
    google.ima.AdErrorEvent.Type.AD_ERROR,
    onAdError,
    false);

function onAdError(adErrorEvent) {
	 console.log("adError");
	 
	 
	document.getElementById("adContainer").style.display = "none";
	 
	 
	 
	 
	     var GameConfig = __require("GameConfig");

          if(GameConfig.playNum == 0){

              adCompleteFlag = true;
            if(adCompleteFlag && resCompleteFlag){

                adCompleteFlag = false;

                var launchScene = GameConfig.launchScene;
                var Bros = GameConfig.Bros;
                var caS = GameConfig.caS;
                cc.director.loadScene(launchScene, null,
                    function () {
                        adCompleteFlag = false;
                        if (Bros) {
                            // show canvas
                            caS = '';
                            var div = document.getElementById('GameDiv');
                            if (div) {
                                 div.style.backgroundImage = '';
                            }
                        }
                        cc.loader.onProgress = null;
                        console.log('Success to load scene: ' + launchScene);
                    }

                );

              

                }

          }
	 
	 
	 
	   adEndComplete = true;
        if(adEndComplete && resEndComplete){
            adEndComplete = false;
            console.log("indexOverErr");
            var MainManger = __require("MainManage");
            MainManger.showGameEndLayer();
        }
	 
  // Handle the error logging and destroy the AdsManager
  console.log(adErrorEvent.getError());
  adsManager.destroy();
}

// An event listener to tell the SDK that our content video
// is completed so the SDK can play any post-roll ads.
var contentEndedListener = function() {adsLoader.contentComplete();};
videoContent.onended = contentEndedListener;

// Request video ads.
var preloader = new google.ima.AdsRequest();
preloader.adTagUrl = 'https://googleads.g.doubleclick.net/pagead/ads?ad_type=video_image&client=ca-games-pub-8708616103041212&description_url=http%3A%2F%2Fwww.vsane.com&videoad_start_delay=-1&hl=zh_CN&max_ad_duration=15000';
// Specify the linear and nonlinear slot sizes. This helps the SDK to
// select the correct creative if multiple are returned.
preloader.linearAdSlotWidth = 640;
preloader.linearAdSlotHeight = 400;
preloader.nonLinearAdSlotWidth = 640;
preloader.nonLinearAdSlotHeight = 400;


// showMyAds();

function showMyAds() {
	// alert("showMy");
		if (typeof(killads)=='undefined'){
			// alert('广告被过滤');
			console.log("AdNo");
			 adEndComplete = false;
			var MainManger = __require("MainManage");
            MainManger.showGameEndLayer();
		}else{
            var winHeight = document.documentElement.clientHeight;

            if (document.body.clientHeight > 700){
                document.getElementById("adContainer").style.height = winHeight-85+"px";
            }else{
                document.getElementById("adContainer").style.height = winHeight-65+"px";
            }
            // document.getElementById("adContainer").style.height = winHeight-60+"px";
         
            document.getElementById("adContainer").style.display = "block";
            adsLoader.requestAds(preloader);
		}
}


function onAdsManagerLoaded(adsManagerLoadedEvent) {
	console.log("ADLoad");
	
	  adCompleteFlag = true;
	
	 // document.getElementById("adContainer").style.display = "block";
  // Get the ads manager.
  adsManager = adsManagerLoadedEvent.getAdsManager(
      videoContent);  // See API reference for contentPlayback

  // Add listeners to the required events.
  adsManager.addEventListener(
      google.ima.AdErrorEvent.Type.AD_ERROR,
      onAdError);
  adsManager.addEventListener(
      google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
      onContentPauseRequested);
  adsManager.addEventListener(
      google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,
      onContentResumeRequested);

var o = document.getElementById("adContainer");
var h = o.offsetHeight; //高度
var w = o.offsetWidth; //宽度
  try {
    // Initialize the ads manager. Ad rules playlist will start at this time.
    adsManager.init(w, h, google.ima.ViewMode.FULLSCREEN);
    // Call start to show ads. Single video and overlay ads will
    // start at this time; this call will be ignored for ad rules, as ad rules
    // ads start when the adsManager is initialized.
    adsManager.start();
  } catch (adError) {
	 
    // An error may be thrown if there was a problem with the VAST response.
    // Play content here, because we won't be getting an ad.
    // videoContent.play();
  }
}

function onContentPauseRequested() {
	
	
  // This function is where you should setup UI for showing ads (e.g.
  // display ad timer countdown, disable seeking, etc.)
  videoContent.removeEventListener('ended', contentEndedListener);
  videoContent.pause();
  
}

//广告结束的时候调用的函数
function onContentResumeRequested() {
	console.log("ADLoadComplete",resEndComplete);
	
	
	
	 var GameConfig = __require("GameConfig");
        console.log("IndexMainManger",GameConfig.launchScene, GameConfig.Bros,GameConfig.caS);

        if(GameConfig.playNum == 1){
            adCompleteFlag = true;
            if(adCompleteFlag && resCompleteFlag){

                var launchScene = GameConfig.launchScene;
                var Bros = GameConfig.Bros;
                var caS = GameConfig.caS;
                cc.director.loadScene(launchScene, null,
                    function () {
						
						
                        adCompleteFlag = false;
						
						
						
                        if (Bros) {
                            // show canvas
                            var canvas = document.getElementById('GameCanvas');
							canvas.style.visibility = '';
                            var div = document.getElementById('GameDiv');
                            if (div) {
                                 div.style.backgroundImage = '';
                            }
                        }
                        cc.loader.onProgress = null;
                        console.log('Success to load scene1: ' + launchScene);
						
						
						
						
						
                    }
                );
				

            }
           

        }
		
		
		
	
	
	
	 adEndComplete = true;
        if(adEndComplete && resEndComplete){
            adEndComplete = false;
            console.log("indexOverErr");
            var MainManger = __require("MainManage");
            MainManger.showGameEndLayer();
        }
	
  // This function is where you should ensure that your UI is ready
  // to play content.
  document.getElementById("adContainer").style.display = "none";
  

  // videoContent.addEventListener('ended', contentEndedListener);
  // videoContent.play();
  
}

function noAdGoToScene(){
	
	
		 var GameConfig = __require("GameConfig");
        console.log("IndexMainMangerMaing",GameConfig.launchScene, GameConfig.Bros,GameConfig.caS);
		
				var launchScene = GameConfig.launchScene;
				var Bros = GameConfig.Bros;
                var caS = GameConfig.caS;
                cc.director.loadScene(launchScene, null,
                    function () {
						
                    adCompleteFlag = false;
						
                        if (Bros) {
                            // show canvas
                            var canvas = document.getElementById('GameCanvas');
							canvas.style.visibility = '';
                            var div = document.getElementById('GameDiv');
                            if (div) {
                                 div.style.backgroundImage = '';
                            }
                        }
                        cc.loader.onProgress = null;
                        console.log('Success to load scene1Main: ' + launchScene);
						
						
						
						
						
                    }
                );
	
	
}



3.mian.js

var loadingNum = 0;
window.boot = function () {
    var settings = window._CCSettings;
    window._CCSettings = undefined;
    var onProgress = null;
    
    var RESOURCES = cc.AssetManager.BuiltinBundleName.RESOURCES;
    var INTERNAL = cc.AssetManager.BuiltinBundleName.INTERNAL;
    var MAIN = cc.AssetManager.BuiltinBundleName.MAIN;


    function setLoadingDisplay () {
        // Loading splash scene
        var splash = document.getElementById('splash');
        var loadintT = document.getElementById("loadingText")
        // var progressBar = splash.querySelector('.progress-bar span');
        cc.loader.onProgress = function (finish, total, item) {
            loadData.completedCount = finish;
            loadData.totalCount = total;
			
			var percent = 100 * finish / total;
			if(loadingNum >= 1 && total > 1){
				if(percent.toFixed(0) >= 100){
                    loadintT.innerHTML = 'loading......100' + '%';
                    clearInterval(timer); 
                    setTimeout(function(){
                        loadintT.remove();
                    },0.1 * 1000);
				}
			}
            loadingNum++;
        };
        splash.style.display = 'block';
        // progressBar.style.width = '0%';

        cc.director.once(cc.Director.EVENT_AFTER_SCENE_LAUNCH, function () {
            splash.style.display = 'none';
        });
    }

    var onStart = function () {

        cc.view.enableRetina(true);
        cc.view.resizeWithBrowserSize(true);

        if (cc.sys.isBrowser) {
            setLoadingDisplay();
        }

        if (cc.sys.isMobile) {
            if (settings.orientation === 'landscape') {
                cc.view.setOrientation(cc.macro.ORIENTATION_LANDSCAPE);
            }
            else if (settings.orientation === 'portrait') {
                cc.view.setOrientation(cc.macro.ORIENTATION_PORTRAIT);
            }
            // cc.view.enableAutoFullScreen([
            //     cc.sys.BROWSER_TYPE_BAIDU,
            //     cc.sys.BROWSER_TYPE_BAIDU_APP,
            //     cc.sys.BROWSER_TYPE_WECHAT,
            //     cc.sys.BROWSER_TYPE_MOBILE_QQ,
            //     cc.sys.BROWSER_TYPE_MIUI,
            //     cc.sys.BROWSER_TYPE_HUAWEI,
            //     cc.sys.BROWSER_TYPE_UC,
            // ].indexOf(cc.sys.browserType) < 0);
            cc.view.enableAutoFullScreen(false);
        }

        // Limit downloading max concurrent task to 2,
        // more tasks simultaneously may cause performance draw back on some android system / browsers.
        // You can adjust the number based on your own test result, you have to set it before any loading process to take effect.
        if (cc.sys.isBrowser && cc.sys.os === cc.sys.OS_ANDROID) {
            cc.assetManager.downloader.maxConcurrency = 2;
            cc.assetManager.downloader.maxRequestsPerFrame = 2;
        }

        var launchScene = settings.launchScene;
        var bundle = cc.assetManager.bundles.find(function (b) {
            return b.getSceneInfo(launchScene);
        });
        var canvas;
        if (cc.sys.isBrowser) {
            canvas = document.getElementById('GameCanvas');
        }
        
        var MainManger = __require("MainManage");
        MainManger.init(launchScene,cc.sys.isBrowser,canvas.style.visibility);
        // bundle.loadScene(launchScene, null, onProgress,
        //     function (err, scene) {
        //         if (!err) {
        //             cc.director.runSceneImmediate(scene);
        //             if (cc.sys.isBrowser) {
        //                 // show canvas
        //                 var canvas = document.getElementById('GameCanvas');
        //                 canvas.style.visibility = '';
        //                 var div = document.getElementById('GameDiv');
        //                 if (div) {
        //                     div.style.backgroundImage = '';
        //                 }
        //                 console.log('Success to load scene: ' + launchScene);
        //             }
        //         }
        //     }
        // );
    };

    var option = {
        id: 'GameCanvas',
        debugMode: settings.debug ? cc.debug.DebugMode.INFO : cc.debug.DebugMode.ERROR,
        showFPS: settings.debug,
        frameRate: 60,
        groupList: settings.groupList,
        collisionMatrix: settings.collisionMatrix,
    };

    cc.assetManager.init({ 
        bundleVers: settings.bundleVers,
        remoteBundles: settings.remoteBundles,
        server: settings.server
    });
    
    var bundleRoot = [INTERNAL];
    settings.hasResourcesBundle && bundleRoot.push(RESOURCES);

    var count = 0;
    function cb (err) {
        if (err) return console.error(err.message, err.stack);
        count++;
        if (count === bundleRoot.length + 1) {
            cc.assetManager.loadBundle(MAIN, function (err) {
                if (!err) cc.game.run(option, onStart);
            });
        }
    }

    cc.assetManager.loadScript(settings.jsList.map(function (x) { return 'src/' + x;}), cb);

    for (var i = 0; i < bundleRoot.length; i++) {
        cc.assetManager.loadBundle(bundleRoot[i], cb);
    }
};

if (window.jsb) {
    var isRuntime = (typeof loadRuntime === 'function');
    if (isRuntime) {
        require('src/settings.js');
        require('src/cocos2d-runtime.js');
        if (CC_PHYSICS_BUILTIN || CC_PHYSICS_CANNON) {
            require('src/physics.js');
        }
        require('jsb-adapter/engine/index.js');
    }
    else {
        require('src/settings.js');
        require('src/cocos2d-jsb.js');
        if (CC_PHYSICS_BUILTIN || CC_PHYSICS_CANNON) {
            require('src/physics.js');
        }
        require('jsb-adapter/jsb-engine.js');
    }

    cc.macro.CLEANUP_IMAGE_CACHE = true;
    window.boot();
}

 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

抖音很火的召唤神龙的小游戏完整代码-召唤神龙 的相关文章

  • 每页都包含菜单

    假设我有一个简单的 CSS 布局 我的菜单是侧面的一列 此菜单将出现在每个网页上 大约 10 个网页 如果我在这个菜单上有链接等形式的项目 我怎样才能做到这样 如果我在一页上添加链接 它会将其添加到所有页面 你能把它做成一个 PHP 页面吗
  • 使用 CSS 的样式选择选项

    我正在尝试使用 CSS 设置选择选项列表的样式 我希望列表的时间之间有更多的填充 因为它们似乎被压在一起 我尝试向选项元素添加填充 但这似乎不起作用 有任何想法吗 这是我的代码 HTML
  • 如何在 IOS safari 上禁用缓存?

    有没有办法禁用 ipad iphone 上的缓存 我想针对非缓存体验运行一些自动化测试 我刚刚偶然发现了一种在 iOS 上禁用 Safari 缓存的方法 iOS Open Settings 导航Safari gt 高级 Enable 网页检
  • 如何更改单选按钮与其文本之间的间距?

    我有以下 HTML
  • 使用 JQuery 更改表附加行中某些单元格的背景颜色

    我正在向表中追加一行 如何更改该行中一组单元格的背景颜色 假设列有 25 列 从 17 到 22 的列需要更改背景颜色 这是我到目前为止所尝试的 table1 append row1 row1 children td not td eq 0
  • 如何使用 javascript/ASP.NET/CSS 旋转和淡入淡出背景图像

    我需要随机淡入淡出背景图像 这将是一个定时函数 例如每 5 秒一次 我需要使用 ASP NET Javascript CSS 或全部三者来完成此操作 请大家帮帮我 谢谢 Cycle 一个 jQuery 插件 是一个非常灵活的图像旋转解决方案
  • 在 IE 中使用
    标签时,填充不起作用

    我在我的应用程序中使用 HTML5 标签 标签的填充在 chrome ff 和 safari 中工作正常 但在 IE 中不起作用 我尝试添加显示 块 与部分样式 但它没有用 有什么解决办法吗 许多旧浏览器不理解 HTML5 标签 例如sec
  • 使用 CSS 屏蔽图像

    我做了这样的设计 如何用CSS遮盖背景 我试过这样的代码 img poster display block max width 100 webkit mask image url https cdn pbrd co images GYiCo
  • 使 html svg 对象也成为可点击的链接(在 iPhone 上)

    这个问题与使 html svg 对象也成为可点击的链接 https stackoverflow com q 11374059 4825796 但给出的答案似乎不适用于 iPhone ios 9 3 safari 和 chrome 浏览器 我
  • CSS - 100% 高度,带页眉和页脚

    我正在尝试设计一个带有页眉 延伸至 100 垂直景观 减去页眉和页脚 的主 div 和页脚的页面 就像这张照片 我可以让标题和主 div 正常工作 像这样 div div class header div HEADER div div cl
  • Flexbox 调整大小和可滚动溢出[重复]

    这个问题在这里已经有答案了 我有正在调整大小的内容 并且我想要一个固定标题 该标题不会增大 缩小 并且不属于可滚动内容的一部分 如果空间不足 下面的内容将变得可滚动 内容外包装 flexGrowWrapper has a flex grow
  • 正常显示截断的文本,但悬停时显示完整文本

    我有一个 div 里面有一段左右的文本 我希望它正常显示前几个单词 但在悬停时展开以显示全文 理想情况下 我想仅使用 CSS 来完成此操作 而不需要重复数据 这是我尝试过的 div 1 ONE div
  • 如何在asp.net背后的代码中获取css样式

    我需要从 asp net c 中的代码后面获取 css 样式 在网上没有找到解决方案 是否可以直接从 styles css 文件获取它 还是需要解决方法 我在我的网络应用程序中使用主题 但我还需要进行一些服务器处理 并且我需要 ccs 文件
  • 如何阅读 CSS 中的 !important ? [复制]

    这个问题在这里已经有答案了 CSS属性属性是怎样的 important read Is it really important exclamation mark important Answer 从下面的答案来看 似乎很简单importan
  • 使用非常大的背景位置偏移是否存在性能问题?

    我正在构建一个进度条控件 并且正在研究它实际上并不显示进度 而只是旋转 正在发生某事 的指示器的情况 我的设计基本上是交替的对角条纹 本质上是一个像这样的理发杆 但是 旋转 由于希望将尽可能多的负载转移给渲染引擎 我想为此使用 CSS 过渡
  • CSS 网格/布局框架,专注于固定元素和单页全屏布局

    经验法则 如果您在布局中过多地使用 CSS 请切换到框架 我已经研究了数十个网格 布局框架 其中大多数都专注于传统的文档网格布局 我的页面更像是一个 SPA 单页应用程序 它类似于桌面应用程序使用的布局 显然 HTML 不能很好地处理这个问
  • Div 独特的 CSS 样式链接

    我想为单个特定 div 中的链接创建独特的样式 例如 我希望主体中的所有链接为粗体和红色 但在侧边栏 div 中我希望它们为蓝色和斜体 我该怎么办 I have a link color 666666 a visited color 003
  • 如果 CSS 是渲染阻塞的,为什么我们会看到 FOUC?

    为了构建渲染树 浏览器需要 DOM 和 CSSOM CSSOM 只有在下载 CSS 后才能构建 本质上 一旦下载了 CSS 页面就应该可以正常渲染了 但是 为什么我们会在页面上看到 Flash Of Unstyled Content FOU
  • 使用 IE9、10、11 的 CSS 将比例打印到 50% 等百分比

    Zoom css 属性不适用于 IE9 10 11 观察到打印预览 UI 令人不安 默认比例为 缩小以适合 当我将此比例从 缩小 更改为适合 50 时 页面显示正常 打印预览 任何人都可以帮助我如何使用 CSS 代码将比例设置为 50 为页
  • Safari 扩展将消息发送到特定选项卡

    有没有办法从全局页面发送消息到特定选项卡 我目前正在做的是 在创建选项卡时 注入的脚本会创建一个唯一的 ID 并将包含该编号的消息发送到全局页面 并且全局页面会保存该编号 如果全局页面需要发送一些数据到一个tab 即 tab 3 然后全局页

随机推荐