Adding onclick event in custom menus - wordpress

I have created menu from admin panel, now I have to add onclick event in li tag of each menu item like below:
<li>Track Suits</li>
For this I have installed https://wordpress.org/plugins/jin-menu/ plugin follow the steps as described in this documentation but onclick event not appearing.Below is the screen shot :

Try the following code. Add this code a file which loads on each page or your header.php in themes
jQuery('a[href="#m-track-suite"]').click(function(){
//...do something..;
});

Related

Disable or hide Add button in ASP.Net grid view footer template

I have been searching for a way to hide or disable the Add button in an ASP.Net grid view footer template. I have found lots of articles explaining how to hide the Delete Edit options in the grid view but that is not what I want to do.
The Delete, Edit, and Add all work fine but I need to hide the Add button when the user clicks Edit to edit a row.
How can I do this?
You can use jQuery to hide another button.
Example:
<script type="text/javascript">
$("#editButton").click(function () {
$("#view").hide();
$("#edit").show();
$("#cancelButton").show();
$("#editButton").hide();
});
$("#cancelButton").click(function () {
$("#edit").hide();
$("#view").show();
$("#editButton").show();
$("#cancelButton").hide();
});
</script>

Contact form 7 Wordpress: Trying to make a dropdown menu to trigger an alert

I am created a contact form in Wordpress, using Contact form 7 - plugin.
Is it possible to create a dropdown-menu, in which, an action is triggered when the user selects one of the options from the menu? e.g. displays an alert saying something like "great choice"?
Here so we select your dropdown menu, we then create a event handler to watch for the user to click on there and then we simply use alert
$('.YourDropDownClass').click( function(){
alert('Great Choice!');
});
Some tools for you to learn JQuery:
http://jquery.com/
http://www.w3schools.com/jquery/

Switching tabs made using CSS inside click event

I have implemented tabbed browsing using this http://css-tricks.com/functional-css-tabs-revisited/
I have a click event inside one of my tabs(say tab1). Is there some way I can redirect from tab1 to tab3 inside this click event??Since, the link says 'no javascript', I am skeptical whether this can be done or not
Adding this inside the eventlistener code works:
document.getElementById("tab-3").checked = true;

css hover menu stops working after Update Panel renders elements

I am using <ul> <li> menu on master page. For menu hover I am using csshover.htc file.
I am <updatepanel> on my child pages, but when I click on any link or button inside update panel, my menu stops working. i.e hover does not work. What can be solution for this?
You need to re-initialise your menu after your updatepanel has fired. In order to do this you need to include something like the following at the bottom of your page:
<script type="text/javascript">
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(CSSHover());‌
</script>
You will find the name of the function to be called at the top of your htc file - You will see something like this:
<public:attach event="ondocumentready" onevent="CSSHover()" />
The function that needs to be fired is the part in the onevent
I got updated htc file from here, and my issue was resolved..

Open lightbox fullscreen when clicked in iFrame?

Here's my page: http://ilijaveselica.com/Gallery/GetCroatiaFavPhotos
I'd like to implement this page into another website. I tried with iframe but lightbox (fancybox) opens only within iframe, not whole page. Any idea how can I solve this without much pain?
Here's how it looks: http://www.croatia-photography.com/
The only way I can imagine of doing that is including the gallery elements within the fancybox script itself.
So, in your page http://ilijaveselica.com/Gallery/GetCroatiaFavPhotos, instead of having this :
$(".fancybox-thumb").fancybox({
// API options here
});
...and all your hidden html anchors for each image of the gallery, have something like this :
$('.gallery').click(function(e){
e.preventDefault();
parent.$.fancybox([
{href:'images/01.jpg', title: '01'},
{href:'images/02.jpg', title: '02'},
{href:'images/03.jpg', title: '03'}
],{
// API options here
}); // fancybox
}); // click
Notice that we are providing the href and title within the brackets. Also notice that we used parent.$.fancybox to indicate that fancybox will open in the parent page and outside the iframe.
Then the only html you would need to open the gallery outside the iframe is :
<a class="gallery" href="javascript:;"><img src="{thumbnail}" alt="" /></a>
For further reference and DEMO (see update), check this https://stackoverflow.com/a/8855410/1055987

Resources