How can I create a customized facebook like button? - javascript

I want to like an application or a page upon the click of a button. This button has an image and my own css. Now when I clikc on it, I want to trigger the like of an application..
How do I achieve this ? Any reference ...

Related

Change an url on an image depending on something checked before

I am trying to make an E-commerce website. I'm using Wordpress/Woocomerce.
But the guy I am working for, wanted special pages with a really special design. So he asked me for something that I did.
But now the fact is that I have a problem with the attributes and adding it to the cart button.
So I'd like to find a way to change the url on the "add to cart" button, which is an image.
Is there anyway to make an url on a page ( not in the search bar, but in the code ) change if u check or uncheck something ?
Like a radio button or anything.
Also I'm looking for a cool way to keep the selected size white once I clicked on. Actually it's just an image with an invert effect on hover . And I just found a way to make all work with 1 page per size but it would be really could if I could change the link on the add to cart button change. I just dont know how to change it.
Here is the link : http://mtcdistrup.cluster003.ovh.net/black-onyx/
As you can see, if u click on S it loads another page and on the new page the add to cart button links straight to the good product.
I hope all is clear and that u can help me a bit.

Canva button in wordpress widget

I want to use canva button in my wordpress widget.
When you create canva button, they provide to you code which you copy and paste into your site, in my case in widget UI. The code looks like this:
<span data-type="poster" data-apikey="3KIFIE6ZHYTPUYNZF3V7" class="canva-design-button">Design a poster</span>
<script>(function(c,a,n){var w=c.createElement(a),s=c.getElementsByTagName(a)[0];w.src=n;s.parentNode.insertBefore(w,s);})(document,'script','https://sdk.canva.com/v1/api.js');</script>
Span is the button, and javascript will include an canva js file in head which will style the button and add click event on it. When you click on the button you will get popup to create some design.
Here is demo how it looks like when you place canva button on the frontend.
And here is screenshot how I am using it, in the widget UI:
The problem is that click event doesn't work when I drag and drop widget into sidebar and the canva popup is not showing. After I drag and drop widget in the sidebar I need to refresh the page in order to have click event work. I guess that this is because HTML of the Widget will be appended to the sidebar, but clicks events are already added.
Is there a way to handle it with some javascript code. Need to say that I cannot change the Canva javascript file so I need to do it with my javascript
The data-api-key is provided by canva. The example one is not valid.

How to send event on plugin?

I am using the leanModal plugin and I like to add some code, in order to meet my needs.
What I did, is to use it as a modal dialog, and I have two buttons. The one button closing the modal dialog, and it is fine. The second button is responsible to use the data inserted into the dialog, and then to close the dialog.
What I am looking now, is when I click the second button, first to validate the data, and then to close the dialog, but this functionality does not exists in the plugin. So, how can I add something like the following:
$('selector').leanModal('close');
Is there a way ?
Note : I hope that my description is ok.

Create a form submit button that enables "open in new window" when the user right clicks?

I have a form submit button that I need to enable the user to be able to right click and get the "open in new window" option, so that the user can have the option of either submitting the form in the current window (by simply clicking the button) or in a new window (by right clicking and selecting "open in new window"). Is this possible?
I know I could sort of do this via creating a stand-alone link/image and use css to make it look like a button, and then use onclick to submit the form when clicked, but this would not work for users that does not have javascript.
UPDATE: To clarify, I am looking for a way to do this without using javascript, or confirm that it is actually impossible to do so without using javascript.
What you could do is have the stand-alone link/image with CSS as you propose, and then use a <noscript> tag to replace it with a traditional form button when Javascript isn't available.

ckeditor: how to wire up menu buttons?

I have ckeditor embedded into one of my pages....but I don't know how to wire up certain buttons in ckeditor to perform specific actions. Most importantly, how do I tell it when the save button is clicked to save the document?
Dave--
The beauty of the save button in CKEditor is that it is setup default to submit the form that it's in. In my company's case, I bolted in CKEditor expecting to have to disable the save button because the larger form already had a save button...but it turns out that it worked right out of the box. Get the system installed, tested, and hit save...see what happens.
You can control the output of buttons in the Config.js file. If a particular button is not to your liking, you can use javascript to define actions or create new buttons there as well. There are fairly good tutorials on this at http://docs.cksource.com/

Categories