Call a JavaScript function through a click on a picture  

Share your tips and tricks here or get help with any Panotour 2.0+ problem!
No bug reports (of any kind) in this forum!
no avatar
smsmforme
New member
 
Topic author
Posts: 4
Likes: 0 post
Liked in: 0 post
Joined: Tue Apr 15, 2014 4:25 pm
Info

Call a JavaScript function through a click on a picture

by smsmforme » Tue May 13, 2014 12:34 am

hello friends,

Any one know how to Call a JavaScript function through a click on a picture there is no example on the internet, I tired hardly but it's not working...

so please help me
Attachments
test.jpg

no avatar
Destiny
Moderator
 
Posts: 7886
Likes: 6 posts
Liked in: 228 posts
Joined: Mon Apr 26, 2010 11:55 pm
Info

Re: Call a JavaScript function through a click on a picture

by Destiny » Tue May 13, 2014 2:34 am

What kind of popup? Your js will need a call id... The id will have the action you need the js to perform...

Destiny..

User avatar
bdd
Kolor Team
 
Posts: 2802
Likes: 14 posts
Liked in: 130 posts
Joined: Tue Jan 18, 2011 4:05 pm
Info

Re: Call a JavaScript function through a click on a picture

by bdd » Tue May 13, 2014 9:46 am

smsmforme wrote:hello friends,

Any one know how to Call a JavaScript function through a click on a picture there is no example on the internet, I tired hardly but it's not working...

so please help me


Your screenshot is OK, except for the semicolumn. Just remove it, and your call is OK.
But you have to be sure that the "dopopup" function can be called from the main HTML file of your tour.

Gérald

no avatar
smsmforme
New member
 
Topic author
Posts: 4
Likes: 0 post
Liked in: 0 post
Joined: Tue Apr 15, 2014 4:25 pm
Info

Re: Call a JavaScript function through a click on a picture

by smsmforme » Tue May 13, 2014 9:53 am

Thank you bdd for answering me,

after I remove " semicolumn" and building panotour project , then open index.html with dreamweaver software go to body section and I put this code after <body> tag immediately

Code: Select all
<script type="text/javascript">
function dopopup(){
   window.open("http://www.darahmedia.com","_blank")
}
</script>


but it's not working, should it work or I have any mistake in my code ?

User avatar
bdd
Kolor Team
 
Posts: 2802
Likes: 14 posts
Liked in: 130 posts
Joined: Tue Jan 18, 2011 4:05 pm
Info

Re: Call a JavaScript function through a click on a picture

by bdd » Tue May 13, 2014 10:00 am

smsmforme wrote:Thank you bdd for answering me,

after I remove " semicolumn" and building panotour project , then open index.html with dreamweaver software go to body section and I put this code after <body> tag immediately

Code: Select all
<script type="text/javascript">
function dopopup(){
   window.open("http://www.darahmedia.com","_blank")
}
</script>


but it's not working, should it work or I have any mistake in my code ?


Try this :

Instead of dopopup() in PTP, write : alert(Hello World)
Do you see the popup when running the tour ?

If yes, then do the call to dopopup(), and in your script just before window.open, add the line :
alert("Hello World");

Do you see the popup when running the tour ?

Gérald

no avatar
smsmforme
New member
 
Topic author
Posts: 4
Likes: 0 post
Liked in: 0 post
Joined: Tue Apr 15, 2014 4:25 pm
Info

Re: Call a JavaScript function through a click on a picture

by smsmforme » Tue May 13, 2014 2:49 pm

"alert(Hello World)"

it's not working with me either

I tried to add sound on the same picture and it's working fine

is JavaScript suppose to work on local PC or I must to upload project on web server ?

User avatar
bdd
Kolor Team
 
Posts: 2802
Likes: 14 posts
Liked in: 130 posts
Joined: Tue Jan 18, 2011 4:05 pm
Info

Re: Call a JavaScript function through a click on a picture

by bdd » Tue May 13, 2014 2:54 pm

smsmforme wrote:"alert(Hello World)"

it's not working with me either

I tried to add sound on the same picture and it's working fine

is JavaScript suppose to work on local PC or I must to upload project on web server ?


How did you check your tour locally ?
Did you use the green button "View last built tour" in Panotour ?
http://www.autopano.net/wiki-en/action/ ... NS_TOOLBAR

To be able to use JavaScript method, you have to use a webserver.

Gérald

no avatar
smsmforme
New member
 
Topic author
Posts: 4
Likes: 0 post
Liked in: 0 post
Joined: Tue Apr 15, 2014 4:25 pm
Info

Re: Call a JavaScript function through a click on a picture

by smsmforme » Tue May 13, 2014 3:17 pm

yessssssss working inside a built-in local web server.

Many Thanks :)

no avatar
Destiny
Moderator
 
Posts: 7886
Likes: 6 posts
Liked in: 228 posts
Joined: Mon Apr 26, 2010 11:55 pm
Info

Re: Call a JavaScript function through a click on a picture

by Destiny » Wed May 14, 2014 8:54 am

Javascript functions can be used for many types of Popups.. Depending on what you need it for.. Here is another option.. Basic JS Calls can be attached to hotspots, polygons or pictures..

http://members.westnet.com.au/dps/js/Im ... lTest.html

Destiny..

no avatar
virtualtur-md
New member
 
Posts: 7
Likes: 1 post
Liked in: 0 post
Joined: Mon Aug 21, 2017 12:00 pm
Info

Re: Call a JavaScript function through a click on a picture

by virtualtur-md » Mon Aug 21, 2017 1:57 pm

good afternoon :)
Help please with the implementation of the following task:
In the tour I want to implement a simple button, when I click on that, I want to load the internal xml file.
How to do it in panotour pro 2.5.8?
I do not know the syntax of calling an xml file, but I have such plugins and capabilities:
https://image.prntscr.com/image/ZgsjWRi ... 5WEqwQ.png
Actions triggered on click-call custom code - Krpano code to call
What is the fit here?
or
Via java script call function
How to implement and what function to do to call an xml file.
Thank you so much :)

no avatar
Destiny
Moderator
 
Posts: 7886
Likes: 6 posts
Liked in: 228 posts
Joined: Mon Apr 26, 2010 11:55 pm
Info

Re: Call a JavaScript function through a click on a picture

by Destiny » Mon Aug 21, 2017 9:45 pm

Hi.. You can try the plugin 'Include an XML' which you can find here... http://www.kolor.com/wiki-en/action/vie ... ra_Plugins

Destiny...

no avatar
virtualtur-md
New member
 
Posts: 7
Likes: 1 post
Liked in: 0 post
Joined: Mon Aug 21, 2017 12:00 pm
Info

Re: Call a JavaScript function through a click on a picture

by virtualtur-md » Tue Aug 22, 2017 8:31 am

Good day please help with the syntax :)
How to properly call / load a new xml file through a function

<script type="text/javascript">
function dopopup(){
window.open("http://www.darahmedia.com","_blank")
}
</script>

in the same window, the internal xml file
How correctly to change this line?
" window.open("http://www.darahmedia.com","_blank") "
Thank you very much

no avatar
Destiny
Moderator
 
Posts: 7886
Likes: 6 posts
Liked in: 228 posts
Joined: Mon Apr 26, 2010 11:55 pm
Info

Re: Call a JavaScript function through a click on a picture

by Destiny » Tue Aug 22, 2017 9:09 am

Hi. I do not get what you are trying to do.. Why can't you simply add a hotspot or button, linked to a WebSite box to open that url..

Destiny...

no avatar
virtualtur-md
New member
 
Posts: 7
Likes: 1 post
Liked in: 0 post
Joined: Mon Aug 21, 2017 12:00 pm
Info

Re: Call a JavaScript function through a click on a picture

by virtualtur-md » Tue Aug 22, 2017 9:46 am

I have my own method on how to implement 3 languages on the tour
I need to download a new xml file when I click on a button in which there will be a new language
Help please if you know how, thanks a lot :)


Who is online

Users browsing this forum: No registered users and 2 guests