Firefox is giving me trouble with my CSS/JS code, but Chrome seems to be working

Having some trouble with this code - it seems to be working fine in most browsers, but Firefox is giving me a headache. I've tried using the moz abbreviations in CSS and JS tweaks, but no luck. Is there a property that Mozilla Firefox doesn't support or am I missing something? Any help would be appreciated.

// CSS:

html, body{
    width:100%;
    height:100%;
    margin: 0 auto;
    padding: 0;
}

body * {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
}

header{
    text-align: center;
}
header > h1{
    text-shadow: 1px 1px 1px #888, 1px 1px 1px #EEE;
    font-size: 10pt;
    color: white;
}
header > h2{
    font-size: 10pt;    
    color: black;
}
header > nav > ul{
    display:-moz-box;
    -moz-box-orient:horizontal;
    display:-webkit-box;
    -webkit-box-orient:"horizontal";
    margin: 0 auto;
    padding: 0;
    list-style:none;
    width: 300px;
    height: 60px;
    position: relative; 
    z-index: 2;
}
header > nav > ul > li{

    -webkit-box-flex: 1;    
    -webkit-user-select: none;
    -moz-box-flex: 1;
    -moz-user-select: none;
}

#carousel{
    -webkit-perspective: 800px;
    -moz-perspective: 800px;
    background: black;  
    padding: 0;
    text-align: center;
    margin: 0 auto;
    border: 1px solid gray;
    box-shadow: 3px 3px 7px #777;
}

#carousel > div{ 
    -webkit-transform-style: preserve-3d;
    -moz-transform-style: preserve-3d;
    padding: 0;
}

#carousel > div > ul{
    -webkit-transform-style: preserve-3d;
    -moz-transform-style: preserve-3d;
    margin: auto auto;
    padding: 0;
    background: transparent;
}

#carousel ul li{
    list-style: none;
    position: absolute;
}


//    JS important part:

function Element(id, width, height, params){

    this.width = width;
    this.height = height;

    this.rotateX = params.rotate.x;
    this.rotateY = params.rotate.y;
    this.rotateZ = params.rotate.z;

    this.margin = 10;

    this.translateX = params.translate.x;
    this.translateY = params.translate.y;
    this.translateZ = -(params.translate.z + this.margin);

    var dom = document.createElement("li");
    dom.style.display = "-moz-box";
    dom.style.mozBoxOrient = "vertical";

    dom.style.width = this.width+"px";
    dom.style.height = this.height+"px";
    dom.style.padding = "10px";
    dom.style.background = "00ff00";
    dom.style.opacity = "0.8";

    //use flex
    var imgObj = getImageUrl();
    var img = document.createElement("div");
    img.style.mozBoxFlex = "10";
    img.style.background = "url("+imgObj.url+") no-repeat white";
    img.style.mozBackgroundSize = "100% 100%"; 

    var title = document.createElement("div");
    title.style.mozBoxFlex = "1";
    title.style.textAlign = "center";
    title.style.paddingTop = "5px";
    title.textContent = imgObj.title;
    title.style.background = "#2e3231";
    title.style.color = "white";
    dom.appendChild(img);
    dom.appendChild(title);

    // dom.style.opacity = "0.8";
    dom.style.mozUserSelect = "none";
    dom.id = id;
    dom.addEventListener("click", elementClickHandler);
    dom.style.mozTransform  = "rotateY("+this.rotateY+"rad) translateY("+this.translateY+"px) translateZ("+this.translateZ+"px)";



    this.getElement = function(){
        return dom;
    }

    this.update = function(){
        dom.style.mozTransform  = "rotateY("+this.rotateY+"rad) translateY("+this.translateY+"px) translateZ("+this.translateZ+"px)";
    }

Answer №1

It appears that you are experimenting with features that have not yet become standard. This can be seen through the vendor prefixes used to test out these features. For Chrome, the prefix is:

-webkit-

You have covered this prefix for Chrome's compatibility. However, Firefox requires a different prefix for these features:

-moz-

If you want wider support across browsers, it is recommended to include all possible variants like so:

-webkit-box-orient: "horizontal";
-moz-box-orient: "horizontal";
-o-box-orient: "horizontal"; //For Opera
-ms-box-orient: "horizontal"; //For IE < 10
box-orient: "horizontal"; //For future use

Consider using Modernizr to streamline some of this in your JavaScript code:

For instance, here is how you can normalize the animation-duration property:

 this.animationDurationNames = {
        'WebkitAnimation' : 'webkitAnimationDuration',
        'OAnimation' : 'oAnimationDuration',
        'msAnimation' : 'MSAnimationDuration',
        'animation' : 'animationDuration'
    };

 var animationDurationName = this.animationDurationNames[ Modernizr.prefixed( 'animation' ) ]; 

By doing this, you can easily reference animationDurationName whenever you need to work with the animation-duration property without having to deal with various prefixes.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Retrieve the text content from a JavaScript alert using WebDriver

Currently, I am utilizing Selenium WebDriver in C# to enhance my knowledge and create automated tests. I recently encountered a particular scenario that has left me puzzled: Imagine you have a website similar to this one: . When attempting to register wit ...

Can you explain the function of a digest attribute?

As a beginner in the world of NextJS, I am currently working on getting my first project ready for production. However, I encountered the following error: Application error: a client-side exception has occurred (see the browser console for more information ...

What is the best way to integrate ES6 ReactJS code into an Express application?

I am trying to initially render my ReactJS application on the server using ExpressJS. Although I have been able to import ES6 modules using require(), the module crashes upon loading because it contains ES6 code (ES6 import and export). Index Route var ...

Using JavaScript to retrieve data from a JSON file and showcase it on a jQuery mobile webpage

I am struggling to retrieve JSON data from a PHP URL using JavaScript and display it within a JQuery mobile "li" tag as a category list. Despite spending the last 8 hours on it, I can't seem to get it working using the code provided below. Any help wo ...

various image proportions in HTML

I have an image with a ratio of 16:9 that I want to use on my website. On one of the pages, I display a list of products with images having a ratio of 340x265. When a user clicks on an item in the list, it takes them to the product page where the same im ...

What is the best way to display the weather information for specific coordinates in ReactJS?

I've been working on a code that retrieves farm details based on longitude and latitude. My goal now is to fetch the weather information for that specific farm using openweathermap However, each time I attempt to do so, an error message {cod: '4 ...

Ways to conceal the picture

Check out the JSfiddle link here for the full code. I'm having trouble with my slider as the last picture keeps collapsing underneath and is not hidden as it should be. I suspect this issue is causing the slider to malfunction. HTML <div class=" ...

Unlimited scrolling feature in Ionic using JSON endpoint

Trying to create an Ionic list using data from a JSON URL. JSON Code: [{"id":"1","firstName":"John", "lastName":"Doe"}, {"id":"2","firstName":"Anna", "lastName":"Smith"}, {"id":"3","firstName":"Peter", "lastName":"Jones"},{......................}] app.j ...

Animating jQuery Accordion in Horizontal Direction Extending to the Far Right

After implementing a horizontal accordion in jQuery based on the tutorial found at the following link: A minor issue arose during animation where a slight space was added on the far right side, causing the tabs to shift slightly. This problem is particula ...

User-initiated closure of popup triggers error during Google sign in

After successfully implementing Google signin locally, I encountered an issue when attempting to login on a server. The error message displayed was: 'Uncaught: popup closed by user' Despite disabling adblockers and other potential interference, ...

Is there a way to sequentially execute requests in a loop?

My goal is to extract a list of URLs from the request body, pass them to a request function (using the request module) to retrieve data from each URL, and then save that data to MongoDB. The response should be sent only after all requests are completed, in ...

Tips for aligning objects within a bootstrap column so that they all have the same starting point on the X axis

To recreate the issue I am facing, I created a basic HTML structure with 2 bootstrap columns. My aim is to have multiple <p> elements in the second column, stacked one below the other. However, the problem arises when these <p> tags contain tex ...

Screen goes dark after switching to full-screen mode (panolens.js/three.js)

Utilizing a library known as panolens for displaying a 360-degree panoramic view, hinging on three.js. Within my application, there are two views: one containing custom content and the other serving as a container for panolens. Initially, the first view is ...

The art of website creation: incorporating images into the background and using image tracing techniques

Trying to figure out where to find a solution for this. I had the idea of using a semi-transparent Photoshop design as a background and building on top of it, almost like tracing over it. This way, aligning things would be much easier. I remember Microsoft ...

Which script, strophe.js or openfire, is responsible for closing the connection upon page refresh?

Currently, I am developing an application using Symfony2 that includes a chat feature. One aspect of this app involves utilizing session management for the chat functionality. 1) Upon logging in, I trigger an event listener to capture the user's cred ...

Internet Explorer 11 Ajax problem

Once again, Internet Explorer is causing some issues. I have a file called validation.php where the values from a text box are sent for validation. The text box value is read and then a result indicates whether it is valid or not. This functionality work ...

Having difficulty connecting images or photos to CodePen

I've been attempting to connect images and sound files to my CodePen project using a Dropbox shared link. <div class="container"> <div class="row second-line"> <div class="col-12"> <div d ...

Executing TipTap commands from a script tag in Vue 3: A step-by-step guide

One of the components I'm working with includes the following: <button @click="$refs.image.click(); editor.chain().focus().setImage({ src: state.image }).run()"></button> <input type="file" ref="image" sty ...

Safari does not support SVG fill pattern, unlike Firefox and Chrome

Having an issue with Safari 6.1.5 not displaying a pattern in an SVG rectangle. After simplifying the code, here is the test case: <html> <head> <style> .patterned { fill: url("#myid") none; stroke:blue} ...

What is the best way to push a variable after employing the split function in JavaScript?

error: An unexpected TypeError occurred while trying to read property 'push'. The error was on this line: " this.name[i].push(arrayData[0]); " I'm confused because the console.log statement before that line shows "data is loaded:" alo ...