Jump to content

stop script stretching text on click

Go to solution Solved by creedon,

Recommended Posts

Posted

Site URL: https://raspberry-garlic-8h62.squarespace.com/

Hi everyone, 

I am testing a script to see if i can implement on squarespace  - but I need it to stop stretching on click.  I'm a beginner at JS and cant figure out how to make the action stop when you click.   Any help would be greatly appreciated! 

@creedon @tuanphan

Site PW: stretch 

Here's the JS 

// stretch text 

var originalWidth = $("h1").width()
var originalHeight = $("h1").height()

$(document).on("mousemove", function (event){
	
	var scaleX = event.pageX / originalWidth
	var scaleY = event.pageY / originalHeight
	
	$("h1").css("transform","scale("+ scaleX +","+ scaleY +")")
	
})
  • Replies 2
  • Views 327
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Create an account or sign in to comment

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

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.