Monday, March 4, 2024
HomeiOS DevelopmentiOS focusing on javascript doesn't work on Ipad, solely iphone

iOS focusing on javascript doesn’t work on Ipad, solely iphone


I’m attempting to create code to focus on ios and substitute a background-attachment:fastened banner with a banner that simply has the picture and never background-attachment property.

The code that I’ve works on iphones, however not on any Ipad. I’ve checked my code with console log and might confirm it really works.

My 2nd piece of code works however it additionally targets android, which I are not looking for. Is anybody else having this drawback and what are they doing about it?

First code

    var isIOS = /iPad|iPhone|iPod/.check(navigator.userAgent) && !window.MSStream;

if (isIOS) {
  console.log('It is a IOS machine');
  let banner1 = doc.querySelector('.hank-banner')
  banner1.take away()
  doc.querySelector('.ios-banner').model.show = "block";
} else {
  console.log('That is Not a IOS machine');
}

Second code

// Test if the machine is an iPad based mostly on contact functionality and display screen measurement
perform isiPad()  navigator.maxTouchPoints > 0 

// Instance utilization
if (isiPad()) {
  // Code to execute if the machine is an iPad
  console.log("That is an iPad");
  let banner1 = doc.querySelector('.hank-banner')
  banner1.take away()
  doc.querySelector('.ios-banner').model.show = "block";
} else {
  // Code to execute if the machine is just not an iPad
  console.log("This isn't an iPad");
}



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments