Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

stop script stretching text on click


failbetter

Question

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 +")")
	
})
Link to comment
  • Answers 2
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

2 answers to this question

Recommended Posts

Create an account or sign in to comment

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


×
×
  • Create New...