Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
rustytusk

CamelCase Browser compability

Go to solution Solved by OSUblake,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi all,

 

I am currently working on a little project and i wanted a header with a background and when you hover over this header-div, the background zooms in. 

However, when I use the camelcase notation in the TweenMax vars, it works fine in Mozilla, but messed up in Chrome, and vice-verse. So 'background-size' works fine on chrome but pretty strange in Mozilla.

 

Hope you can help,

 

thanks in advance!

 

rusty

See the Pen Gpyroy by anon (@anon) on CodePen

Link to comment
Share on other sites

  • Solution

I'm not sure why background size behaves like that. If you use a width and height with the camel case it seems to work, but you also have to set it first.

 

See the Pen zvpNPB?editors=001 by osublake (@osublake) on CodePen

 

I was just looking at this thread, and they used kebab case with only one dimension. However, I'm not sure if it worked in Firefox and the demo doesn't seem to work anymore, but I do remember it working in Chrome.

 

http://greensock.com/forums/topic/12053-handle-size-of-backgroundimage/

Link to comment
Share on other sites

To add to Mr OSUblake's  great advise:

 

Here is codepen demo example i made last year that still works in Firefox and uses backgroundSize in camelCase form

 

See the Pen AigpI by jonathan (@jonathan) on CodePen

 

:)

Link to comment
Share on other sites

I actually came up with my answer based on your pen. 

  • Like 1
Link to comment
Share on other sites

Thanks a lot guys, this did the trick! CamelCase with two values (width and height) works well in both browsers!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×