I have custom form like element made with javascript. It works a bit like the HTML select. I.e. clicking on its pull-down control displays a pop-up of options and when you click on an option, the pop-up collapses.
I would also like to collapse the pop-up when you click somewhere else on the page. E.g. another control. At the moment I have a click event attached to the body element to do this, but it doesnt seem like the correct way to do it. Any suggestions for a better way to detect when to collapse the pop-up?
Related
I want to enable the paste option of the context menu (right click menu) when someone right clicks in a div. It seems that it only appears in inputs and textareas, but the "paste" event is global.
I need people to right click a div and have the paste option in their menus.
Can it be done?
What you want to achieve is no longer supported: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/contextmenu
But, you can build your own contextmenu. For that, you have a great example here: How to add a custom right-click menu to a webpage? based on oncontextmenu javascript event: https://www.w3schools.com/jsref/event_oncontextmenu.asp
As always, there's a library for everything, maybe you'd like to try this one: http://ignitersworld.com/lab/contextMenu.html (I've never used it, first result on Google)
I'm using TagCommander and I'm trying to fire a specific tag when a user click or scroll within a certain page.
I can easily detect clicks and scroll and fire an event/set a variable according to that, but I can't find a way to fire a Tag when that happens.
My tag should actually fire according to a specific perimeter (a subset of pages) and when a user does some specific action on the page (i.e. click or scroll).
Is there any way to do that?
it's been a while, maybe you found a solution.
To let a click fire, you should go to:
Triggers > edit > choose "Clicks" from the horizontal menu. Under "selector path" insert the CSS selector path of the Button/Link/Call to Action that you want to track. Click on "done".
If you don't know how to select the CSS selector,
go to your website,
open the chrome console,
activate the tab "Elements",
activate the array,
select with the mouse the Button you want to track
in the Tab "Elements" the Elements will be highlighted in its code
if you go on the line all to the left it will appear 3 points (...), click on them and select "copy selection" > CSS Path
it should be something with #, for example #tab1234
I want to use colorbox to display a form. The form will have two buttons, one for submitting the form and one for dismissing the window created by colorbox.
I have been following the examples, particularly the so called Outside HTML (Ajax). It works, but I am trying not to show the close button and to hidden also the whole bar that colorbox uses to display the title and other button for galleries.
If I set closeButton:false, the close button is not shown but I still have some white space at the bottom that I'd like to remove.
Do you know how to achieve this?
I have html code where dropdown menu has several values including "Custom". I would like to have different html content below dropdown menu depending on user selection. If user chooses "Custom" value then I need to show one more dropdown menu and two editboxes and if in any other cases I need to show only one editbox.
As I understand I need to use onchange() event and javascript code. Is that right?
Could you please advice?
Thank you.
It seems like you are just getting started with this. Yes, you are probably going to end up using javascript for this. You need to understand that javascript is used to
Modify the DOM (i.e. the html) on the page dynamically
Detect events that happen on different elements of the DOM(e.g. a div or the window).
among other things.
The change event is only one event. Depending on the requirements, you might want to use change, but you might want to show the submenu when the user hovers the pointer over Custom.
Be aware that there are probably libraries you can use to show menus with submenus.
If you want to roll your own, you should try the following:
Show a div that looks like a popup when the user clicks a button or some area of the screen.
Populate the popup with the menu options
Detect when the user mouse-over or clicks the 'Custom' option.
Display the submenu.
I need to display a mobile-phone compatible popup menu when user left-clicks a HyperLink control. A menu will contain various options for this link, so its handler had to be aware of the clicked link data (actually, each link corresponds to a nickname).
What do I need to make that work?:)
Here are some links with pop menou.
http://www.php-development.ru/javascripts/dropdown.php
http://www.dynamicdrive.com/dynamicindex1/index.html
http://www.1stwebdesigner.com/resources/38-jquery-and-css-drop-down-multi-level-menu-solutions/
I think that there are too many more to find on google.