GithubHelp home page GithubHelp logo

Comments (5)

hustcc avatar hustcc commented on May 31, 2024

can do it on v2.0.0.

from canvas-nest.js.

sli1989 avatar sli1989 commented on May 31, 2024

@hustcc how to control it in v2.0.1?

from canvas-nest.js.

hustcc avatar hustcc commented on May 31, 2024

You can detect the env to decide whether load canvas nest or not.

from canvas-nest.js.

sli1989 avatar sli1989 commented on May 31, 2024

Thanks, can it do in swig? I want to add condition in Next theme, but don't know how to do it. Is there any examples I can look around,

from canvas-nest.js.

viclw17 avatar viclw17 commented on May 31, 2024

@sli1989
You can add a function in the script to return the type of the platform, and use it to branch in the drawing function. As a hack it's working fine for me.

  function getBrowserType() {
  	var browserType = "Undefined";
  	var browserAgent = navigator.userAgent;
  	if (browserAgent != null) {
  		if	(	browserAgent.indexOf("Mobile") >= 0
  			||	browserAgent.indexOf("Android") >= 0
  			||	browserAgent.indexOf("BlackBerry") >= 0
  			||	browserAgent.indexOf("iPhone") >= 0
  			||	browserAgent.indexOf("iPad") >= 0
  			||	browserAgent.indexOf("iPod") >= 0
  			||	browserAgent.indexOf("Opera Mini") >= 0
  			||	browserAgent.indexOf("IEMobile") >= 0
  			) {
  			browserType = "MOBILE";
  		}
  		else {
  			browserType = "DESKTOP";
  		}
  	}
  	return browserType;
  }

In function draw_canvas() ,

function draw_canvas() {
     if(getBrowserType() === "DESKTOP"){
         // ...
     }
}

--> Ref.

from canvas-nest.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.