Instant CSS transformation occurs on Safari browser

I am new to coding and trying to learn on my own. I want my code to work smoothly across all popular browsers, starting with Safari. Currently, the -webkit-transition: transform 1.0s; property in my CSS code works instantly in Chrome but not in Safari. Not sure if I need an additional meta tag or something. Here is a snippet of my code:

HTML

<section id="prismSection">
    <h1 class="text-center">Now a Rectangular Prism</h1>
    <div class="prismWrapper">
        <div id="prism">
            <figure class="front"><p>Front</p></figure>
            <figure class="back"><p>Back</p></figure>
            <figure class="right"><p class="vertical-text">Right</p></figure>
            <figure class="left"><p class="vertical-text2">Left</p></figure>
            <figure class="top"><p>Top</p></figure>
            <figure class="bottom"><p>Bottom</p></figure>
        </div>
    </div;

    <button class="btn btn-lg btn-primary" onclick="prismFront();">Front</button>
    <button class="btn btn-lg btn-primary" onclick="prismBack();">Back</button>
    <button class="btn btn-lg btn-primary" onclick="prismRight();">Right</button>
    <button class="btn btn-lg btn-primary" onclick="prismLeft();">Left</button>
    <button class="btn btn-lg btn-primary" onclick="prismTop();">Top</button>
    <button class="btn btn-lg btn-primary" onclick="prismBottom();">Bottom</button>
</section>

CSS

#prismSection {
    text-align: center;
    padding-bottom: 40px;
}
#prismSection > button {
    border: 2px solid black;
}
#prismSection > h1 {
    color: white;
    font-family: Paytone One, arial;
    font-size: 2.5em;
}

/* The rest of the CSS styles remain unchanged */

Javascript

// Javascript functions to handle prism transformations

// jQuery shorthand for document ready function
$(function() {

    // Button click events for prism rotations
    $('#btnFront').on('click', function() {
        $('#prism').css('transform', 'translateZ( -50px ) rotateY( 0deg )');
    });

    // Repeat similar event listeners for other buttons

});

I will attempt to create a JSFiddle demo soon. Thank you!

Edit:

I have updated the button functions using jQuery syntax and individual IDs for each button:

<script type="text/javascript">
    $(function() {

        $('#btnFront').on('click', function() {
            $('#prism').css('transform', 'translateZ( -50px ) rotateY( 0deg )');
        });

        // Implement the same logic for other button clicks

    });
</script>

No changes observed in the behavior.

Answer №1

Your transition rules should be applied to the "transform" rule, not the prefixed rules like -webkit-transform. This means that the transition will not take effect on a -webkit-transform rule.

Try using:

-webkit-transition: -webkit-transform 1.0s;

If this does not resolve the issue, utilize Safari's Web Developer tools to identify which rules are affecting the elements (invalid rules will be crossed out).

UPDATE: For clarification, view JsFiddle here: link

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

Exploring the near method to Parse.Query a class

I'm currently working on my first iOS application, which allows users to add annotations to a map for others to view. In this project, I have decided to utilize Parse as the backend service. What I already have: There is a class called "Pins" in Par ...

I am interested in retrieving data from MySQL by utilizing the FullCalendar plugin

Is there a specific location in my PHP code where I should place a for loop in order to loop through dates in the database? Take a look at this snippet: <script> $(document).ready(function() { $('#calendar').fullCalendar({ d ...

Developing a collection of customized shapes comprised of circular-edged rectangles using the Three.JS

I have been on a quest for some time now. My aim is to replicate this visual element from - the beautifully arranged deck of cards. I know it was created using Three.JS, and my goal is to recreate it exactly as seen in that link. The challenge I'm c ...

Retrieve the file name of the webpage from the URL bar

Is there a way to retrieve the page name from the address bar using jquery or javascript instead of PHP? I am working on an HTML website and would prefer not to use PHP for this specific task. For example, if the address is www.mywebsite.com/hello.htm, ho ...

Run a function after all xmlHttpRequests have finished executing

OVERVIEW My website relies on an API to fetch data, making multiple post and get requests to a server upon opening. While we know how long each individual call takes, determining the total time for all calls to complete is challenging. SCENARIO For inst ...

Display a custom error message containing a string in an Angular error alert

How can I extract a specific string from an error message? I'm trying to retrieve the phrase "Bad Request" from this particular error message "400 - Bad Request URL: put: Message: Http failure response for : 400 Bad Request Details: "Bad Request ...

Eliminate any line breaks from the information retrieved from the node event process.stdin.on("data") function

I've been struggling to find a solution to this issue. No matter what approach I take, I can't seem to remove the new line character at the end of my string. Take a look at my code below. I attempted using str.replace() in an effort to eliminate ...

A comprehensive guide to leveraging synchronous execution of setTimeout in JavaScript

Can the desired output shown below be obtained using setTimout? If it is possible, please provide your insight: console.log("1st"); setTimeout(() => { console.log("2nd"); },0); console.log("3rd"); The expected output should be: 1st 2nd 3rd ...

Offspring with percentage-based widths inside a parent element also specified with percentage-based

I have a group of (pseudocode) elements that look like this: <div id="parent"> <a><div id="child1 class="children"></a> ... <a><div id="child-n class="children"></a> </div> These elements are st ...

An easy way to export static images in Next.js

Whenever I try to export my nextjs app, an error message pops up stating that image export is not supported on static websites. Error: The default image loader in Next.js cannot be used with next export. Possible solutions: - Use next start to run a serv ...

Exploring the Brilliance of MVC PHP/AJAX

I am currently in the process of developing a PHP website that will showcase statistics derived from an external source. To illustrate how the MVC (Model-View-Controller) architecture will be implemented, I have created this unique diagram. As someone wh ...

How can one access the precise and straightforward code for implementing the Facebook pixel?

(I am continuously refining this question, feel free to help me articulate it better. I have provided my own answer to assist in framing the question more effectively) Explicit - in this context, means "direct". The code provided by Facebook is minified a ...

Issue with displaying modal and backdrop specifically on iPhone in Angular 13

Within our Angular 13 application, we have a modal component. The component's CSS includes the :host selector for the root element, which also serves as the style for the backdrop: :host { position: absolute; background: rgba(0, 0, 0, 0.5); widt ...

Transform Firebase Cloud Function TypeScript syntax into JavaScript

@ParagonLance shared an insightful cloud functions tutorial here, however, the cloud function code snippet is written in TypeScript instead of vanilla JavaScript. What steps would be needed to convert the following TypeScript code into pure JavaScript? c ...

Letter Shifts Challenge - misguided alterations

I recently encountered a coding challenge called Letter Changes on a platform called Coderbyte. The challenge requires us to modify a given string following a specific algorithm. The task is to create a function called LetterChanges(str) that takes a stri ...

Easiest method for implementing event emitter in ES6

Here is the current setup for my event emitter: class Table { set onDiscard(cb) { this._onDiscard = cb; } notifyDiscard(s) { if (this._onDiscard) { this._onDiscard(s); } } } Dealing with multiple events using this method can b ...

Utilizing a Static Image Path Prop in React JS: A Step-by-Step Guide

My Main Component import React from "react"; import TopModal from "./components/topModal"; // Passing productImage to the Child Component import productImage from "../../../../../../assets/images/juices.jpg"; import { makeS ...

React Modals: Only the modal component triggered by the first click will open, with no other modals opening

As a newcomer to StackOverflow, I apologize if my problem description is not clear. I am currently learning React and working on a course-search app as a project. The app filters courses based on user input from a JSON file and displays them in cards with ...

The 1920px minimum width is not triggering as expected

When using @media screen and (min-width: 1920px), the style is not applied until the min-width is changed to 1396px on a 1920x1080 screen. Despite accounting for the scroll bar size, the issue persists. It seems unlikely that any other CSS is overriding t ...

What could be causing the issue of Vuejs 3.3 defineModel consistently returning undefined?

I am currently working with Nuxt version 3.5.1 and Vuejs version 3.3, however, I am encountering an issue where the defineModel macro always returns undefined. I am unsure why this is happening? <template> <input v-model="count"& ...