Adding custom javascript in Oblect Properties > Events

All WYSIWYG Web Builder support issues that are not covered in the forums below.
Forum rules
IMPORTANT NOTE!!

DO YOU HAVE A QUESTION OR PROBLEM AND WANT QUICK HELP?
THEN PLEASE SHARE A "DEMO" PROJECT.



PLEASE READ THE FORUM RULES BEFORE YOU POST:
http://www.wysiwygwebbuilder.com/forum/viewtopic.php?f=12&t=1901

MUST READ:
http://www.wysiwygwebbuilder.com/getting_started.html
WYSIWYG Web Builder FAQ
Post Reply
Aris
 
 
Posts: 204
Joined: Wed Aug 28, 2013 9:28 am

Adding custom javascript in Oblect Properties > Events

Post by Aris »

Hello.

Having an animated gif image (with 5 loopings) I wish to have a user of webpage thw ability to repeat the the animation.

I tried to add in Image > Events the following:
Event: onclick
Action: javascript
Target: history.go(0); This is what I added by hand.

The webpage is reloading and the image proceeds to an new repetion.

Tell me, please, is there something wrong here? I am asking because I added the code by hand.

Thank you.
User avatar
Pablo
 
Posts: 23007
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Adding custom javascript in Oblect Properties > Events

Post by Pablo »

Isn't the GIF animation automatically repeated?
Aris
 
 
Posts: 204
Joined: Wed Aug 28, 2013 9:28 am

Re: Adding custom javascript in Oblect Properties > Events

Post by Aris »

The GIF is repeated automatically only 5 times (it is my choice). But since the image (showing the effect of the mistral wind) has dimensions on the website of 1000X600 pixels, I chose to repeat it only 5 times. If the user wishes to see the wind movement again, he can refresh the webpage to see again the animation.

Of course, I would like just refresh the layoutgrid of the image and not the whole webpage, but I ran into a lot of trouble.

Do you think the history.go(0); option --the way I incorporated it-- will cause problems?

Thank you.
User avatar
Pablo
 
Posts: 23007
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Adding custom javascript in Oblect Properties > Events

Post by Pablo »

If it works for you then I think it's ok.
User avatar
crispy68
 
 
Posts: 2955
Joined: Thu Oct 23, 2014 12:43 am
Location: Acworth, GA
Contact:

Re: Adding custom javascript in Oblect Properties > Events

Post by crispy68 »

@aris,

Is this what you are after?
DEMO
Aris
 
 
Posts: 204
Joined: Wed Aug 28, 2013 9:28 am

Re: Adding custom javascript in Oblect Properties > Events

Post by Aris »

It's the solution I was looking for!

Thank you.

may I use it?
User avatar
wwonderfull
 
 
Posts: 1536
Joined: Fri Aug 21, 2020 8:27 am
Contact:

Re: Adding custom javascript in Oblect Properties > Events

Post by wwonderfull »

Aris wrote: Wed Sep 07, 2022 12:43 pm It's the solution I was looking for!

Thank you.

may I use it?
Although it is a demo but you can do the same thing in your project. It was given to use. So Yes, you can can use it without a doubt.
User avatar
crispy68
 
 
Posts: 2955
Joined: Thu Oct 23, 2014 12:43 am
Location: Acworth, GA
Contact:

Re: Adding custom javascript in Oblect Properties > Events

Post by crispy68 »

@Aris,

Yes! you can use it. Just wanted to make sure it was what you were looking for.

Give me a little bit and I will provide the steps here and share how to do it.
User avatar
crispy68
 
 
Posts: 2955
Joined: Thu Oct 23, 2014 12:43 am
Location: Acworth, GA
Contact:

Re: Adding custom javascript in Oblect Properties > Events

Post by crispy68 »

Here are the steps:

1. Open up your button (in my demo I'm using a themeable button with button type set to "link button"), go to the link tab and enter the following in the URL:

Code: Select all

javascript:restart('Image1','images/NameOfGif.gif');
You will need to replace "Image1" with the ID of your gif image and replace "images/NameOfGif.gif" with the url path and gif name. If all of your images are placed into the default images folder then you only need to change the name of your gif in the above code.

2. Open up an html object, set Type = Before </body> and enter the following:

Code: Select all

<script type="text/javascript">function restart(id,url){var img=document.getElementById(id);img.src="";img.src=url;}</script>
Aris
 
 
Posts: 204
Joined: Wed Aug 28, 2013 9:28 am

Re: Adding custom javascript in Oblect Properties > Events

Post by Aris »

Thank you, crispy68.

Your assistance is valuable!!!
windsurfer
 
 
Posts: 191
Joined: Mon May 13, 2019 9:15 pm

Re: Adding custom javascript in Oblect Properties > Events

Post by windsurfer »

How would i call a custom javascript in the event ?
I used to have a photographic memory but i ran out of film !!!
User avatar
crispy68
 
 
Posts: 2955
Joined: Thu Oct 23, 2014 12:43 am
Location: Acworth, GA
Contact:

Re: Adding custom javascript in Oblect Properties > Events

Post by crispy68 »

Choose javascript as the action and enter the code.
Post Reply