Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do I know which javascript function is being triggered when I click a button and how do I trigger that manually?

Posted on 2014-07-19
9
Medium Priority
?
193 Views
Last Modified: 2014-07-24
Hi,

I am attaching a screenshot of my site with a corner highlighted. when I click on the pause button the gallery in the background pauses.

I know the following things:
There is a javascript attached that contains a function that I think causes this to happen. The javascript is http://www.nicolettavascotto.com/wp-content/themes/coldfusion/main.js and the code is function pauseBgVideo(){ if(activePlayer=='youtube') ytplayer.stopVideo(); else if(activePlayer=='vimeo') $f(vmplayer).api('pause'); else if(activePlayer=='jwplayer') jwplayer('jwP').pause(); $('.pauseVideoBL').hide(); $('.playVideoBL').show(); }
On the main HTML of the page that wordpress generates there is a div with class pauseVideoBL that calls the pauseBgVideo() function
The class of the pause button itself is currentItemPaused and it only appears when the mouse is over the button



I have tried the following functions in the header without any success:
$(document).ready(function(){ $j(document).find(".currentItemPaused").trigger("onclick") });
$(document).ready(function(){ $j(".videoBL").find(".pauseVideoBL").trigger("click") });
$(document).ready(function(){ pauseBgVideo() });

Please help! I need to be able to pause the background gallery when I click on menu items in the top right hand corner.

Any assistance will be appreciated.

The website is: http://www.nicolettavascotto.com

Screenshot of homepage
0
Comment
Question by:badwolfff
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 40206112
You want to look at the plug in documentation.  Which plug in or js is running the background and what is the url to the developers site.  We can look there for the api.
0
 
LVL 19

Expert Comment

by:NerdsOfTech
ID: 40207168
$(document).ready(function(){
    pauseBg();
});

Open in new window

0
 
LVL 19

Expert Comment

by:NerdsOfTech
ID: 40207170
Or on each link:
use the

onClick="pauseBg();"

parameter
0
Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

 

Author Comment

by:badwolfff
ID: 40211686
Hi NerdsOfTech,

It doesn't work. I tried it. In fact I have left that code on the site.

thanks
0
 

Author Comment

by:badwolfff
ID: 40215653
I've requested that this question be deleted for the following reason:

Seems like it can't be solved. I've tried everything and have gotten fed up.
So I have changed the wordpress template and it all works fine now.
thanks anyway
0
 
LVL 19

Accepted Solution

by:
NerdsOfTech earned 2000 total points
ID: 40215654
You had the onclick and href on your <li> instead of your <a> tag (what I referred to as LINK in my answer) and you have a href on your <a> that needs to be voided (with href="#")

<li data-tip="Pause Video" id="menu-item-62" class="mBL pauseVideoBL menu-item menu-item-type-custom menu-item-object-custom current-menu-item current_page_item menu-item-home"><a href="#" onclick="pauseBg();"><span class="title">Home</span><span class="description"></span></a>


<li data-tip="Pause Video" id="menu-item-63" class="mBL pauseVideoBL menu-item menu-item-type-post_type menu-item-object-page"><a title="Sculture" href="#"  onclick="pauseBgVideo();"><span class="title">Sculture</span><span class="description"></span></a></li>

Open in new window

0
 

Author Comment

by:badwolfff
ID: 40215674
Ok thanks I will try it tomorrow
0
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 40215681
Actually, you want to use, href="javascript:void(0)" instead of href="#" http://www.artandlogic.com/blog/2013/07/anchors-hash-sign-javascriptvoid0/

Glad you have it working.  Sometimes those WP templates are not coded very well.
0
 
LVL 19

Expert Comment

by:NerdsOfTech
ID: 40215730
@scott javascript: void(0) isn't applicable here since he wants to run javascript code and that would void out the click.

However, he could optionally code: href="javascript: pauseBgVideo();" and omit the onClick call.
0

Featured Post

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question