To change group image(what's the _calcBounds() do?) - javascript

When we want to change the src,we can use setElement().
The Example such like
`https://jsbin.com/lowuqezofu/1/edit?html,js,output`
It changes when we click the button at the bottom.
But when I add the image to the group like
`https://jsbin.com/xerureviwe/edit?html,js,output`
I want to use _CalcBounds() to update the group,but it runs error.
So I find the other document to solve it.
Here is the people who have related questions on it.
Because I haven't see this function on official tutorial of website.
I think I may not make some mistake.
If we don't need addWithUpdate() or removeWithUpdate() just set image src,is this method can do update function we want?
If not,is there any alternative to do this way?

Thanks for others view the question.
However,I haven't find the suitable solution yet.
I use addWithUpdate() and removeWithUpdate() stupidly instead of using _calcbounds() which function I don't really understand.
It's not a good answer indeed.
But non-perfect solution can solve our problem,that's enough.
Thanks everyone again and please forgive my poor English.

Related

bootstrap tagsinput source not working

I am trying to bind tagsinput with source option but it is not working. I am not understanding what I am missing there. Its a small code which I took from their official site http://www.jqueryscript.net/demo/Nice-Tags-Manager-Plugin-with-jQuery-Bootstrap-Bootstrap-Tags-Input/examples/. Also there is no error on console. fiddle
$(document).ready(function () {
$('#aa').tagsinput({
source:['ams','bms','lite']
})
});
This might not be the answer you are looking for but I feel that I must share my experience. I've tried A LOT of these third-party javascript tagging systems (including yours). Some didn't workedl; some did but some functionality was missing, etc. The solution that I've found to work best is selectize.js. It has most of the required functionality, here is some of it:
Add and remove items in any order without touching your mouse.
You can choose whether the user can create new tags or use only the ones you've provided for them
You can limit the count to your tags
It has a nice interface
It is fairly simple to use
I know this doesn't answer your question but I just feel obliged to tell you given the fact that I've wasted so much time searching for that kind of thing.

count objects in javascript

I have a little js problem and thought this wonderfull community would be able to help me!
Let's say I want to find all $('footer') elements and I want to know if there is either 1 or 2 footers on the page.
How would I do that?
using length() or something similar?
Thanks a lot for your help :)
Use the length[docs] property.
$('footer').length;
Please see the jQuery docs.
They're really very good, and typing length into the search field would dynamically bring the solution to you.
Or use the .size() function - see jquery docs
$('footer').size();
You can of course just use:
document.getElementsByTagName('footer').length;
But footer is an HTML5 element, many browsers in use do not support it yet.

Create a Custom Control using Javascript

I've been trying to do some research into this, but I haven't yet found anything related to this, so I've come here in hopes that someone might be able to point me in the right direction.
Is there any way at all that we can create our own HTML Elements?
I've seen a Custom ComboBox that was created using Javascript months back, but cannot find it anymore.
Basically, I'd like to create my own 'Control', that I can use for my pages. Maybe something that can be just 'plugged in' (although not a requirement). Any thoughts/ideas/advice/links?
Any help is really appreciated. Thank you!
If you want to write a JQuery plug-in but don't know where to start, have a look at this site: http://stefangabos.ro/jquery/jquery-plugin-boilerplate
He's written a boilerplate code for a jquery plug-in, with plenty of comments explaining what to do and how to expand it. It should make a good starting point for you.

Javascript forward backward buttons

I'm using the s3Slider javascript slideshow on the homepage of a site I am developing:
http://alexisparkinn.com/
I really like this slideshow but it has no way to enable the user to go to the next or previous image.
How can I add these buttons? Does anybody know the necessary javascript code I need to use or what changes should be made.
Suggestions? Any help would be greatly appreciated.
Thanks!
I know you didn't ask for suggestions, but let me just throw this out there as a solution:
http://jquery.malsup.com/cycle/
After messing around with a ton of sliders, I've ended up going back to this one time after time. (and there is a 4KB version if all you want is the fade effect)
It has pretty decent documentation and is overall pretty easy and straightforward to use.
Anyway, just wanted to throw that out there. Best of luck to you!
Just to hack something in, I'd modify your s3slider copy to include something like this (insert at line 38)
$(element).bind("s3slidernext", function() {
current = items[currNo+1];
fadeElement(false);
});
Then you can probably just call
$('#s3slider').trigger("s3slidernext");
To move the slider forward. Bind that to a button and you're all set.
there are many jquery libraries that can help you out there like http://sorgalla.com/projects/jcarousel/

Implementing a simple feedback form in JS

How do I implement the feedback form that the following sites have?:
http://foodoro.com/
http://www.heyzap.com/
(look at the left center.)
Thanks!
You should probably checkout the JQuery or similar library for this sort of effect. There are heaps of great tutorials and plug-ins out there.
I would use this code in github
https://github.com/lorenzoongithub/getsomefeedback
as a template / boilerplate.
It should be quite easy to adapt to your requirements.
Start by looking into jQuery. It's pretty nice for stuff like this.
http://www.webdesignerwall.com/tutorials/jquery-tutorials-for-designers/
The first example on there shows a simple way to at least get a sliding panel. It's not exactly what you want but it gives you an idea of what jQuery can do and maybe how you'd achieve what you want.
Edit: Here's a direct link to the sliding panel demo on there...
http://www.webdesignerwall.com/demo/jquery/simple-slide-panel.html

Categories