I need some help regarding tabs.
We are building a intranet portal for our clients, where they will be able to create business cards and more. But we've come to a halt because of problems with tabs.
We need to have a approx 1-4 steps process in tabs. 1 step is to select a business card template. When the template is chosen the next step would be to fill it out.
However each template has different kinds of input fields making the height of the step 2 tab variable.
We've tried using the tabs from Jquery UI, but only the first step is working, since the next step on some templates will be cut off, because of the height.
What is the best way around this problem?
I've used JQuery tabs a lot, and never seen this problem. AFAIK, there is nothing about the tabs themselves that restricts the content that can be put inside them. I would try removing all the logic, html, additional js etc from your tabs, and making the content simple (a series of divs with a fixed height for example). I think you will see that the tabs simply open up to the full height of their contents. Then start adding your code back in until you find whatever it is that restricts the height of your tabs. BTW, I don't think it makes any difference whether they tabs are statically created or loaded via ajax either ...
Can't u also write some code like height() to fix the jquery ui thing? I think jquery ui is the best choice.
Related
I have a use case where there are thousands of items on a list shown to the user. They are loaded a small batch at a time and I see the network traffic going in and out, I see data getting loaded. I see the DOM getting bigger, but the list itself in the UI stops updating (Chrome).
When I examine it, I see thousands of items in the code, when I select the items through console and make it count them, I see the proper number. But in the page itself, I don't see these items get displayed. The list uses drag-and-drop to put items from it into another list (and load additional data about them).
Not using jquery.datatables at the moment, but been meaning to migrate to them a long time ago. I can’t find a good example, though, everything I see uses pagination to split, but what if this is not an option?
How can I pinpoint what it is that is preventing the items from display? The number of entries will vary between 500 and 20 000.
Never mind. everything works as intended, duh. I was stupid and missed something very obvious: things had "display: none" for a very good reason about which I totally forgot (has to do with the core logic of the application). Next time hit me with a stick so I could remember to pay more attention.
Not sure what you meant by saying 'DOM getting bigger' but 'don't see items get displayed'.
Typically JS has a main thread which will handle functions/callbacks as well as view-refresh. So if you operation is blocking , the view will not be refreshing.
As for the pagination is not an option thing, you can consider using DOM-lazy-Loading mechanism where you only put what should be in the current viewport into the dom. As user scroll, you calculate the scroll height dynamically to add/remove items to/from the DOM. One thing to remember is you typically need to define a fixed height for your rows so that you could do the calculation. This lazy-loading way is a common way of solving this type of problem and is widely used by different frameworks like GXT, angular-gird..etc.
I'm working on a music editor/sequencer app that will be written in JavaScript+HTML5 and will make use of the canvas element and Chrome's Web Audio API (I already have a simple prototype working).
One of the things I'm not so sure about is how to implement the GUI for this. It will need to have many different views, and I'd like to perhaps have each view in a different clickable "tab", with one tab in the foreground at a given time and all the others hidden. I'm just not sure how to go about implementing all these tabs.
Would it be better to implement each tab as a different HTML layer and have buttons control which layer shows up on top? Would it be better instead to (re)generate HTML on the fly when the tab buttons are pressed?
Your advice is appreciated.
Would it be better to implement each tab as a different HTML layer and
have buttons control which layer shows up on top? Would it be better
instead to (re)generate HTML on the fly when the tab buttons are
pressed?
I would lean towards generating the content once and showing/hiding it on demand especially if the majority of work is done in the browser and there are no synchronous requests being made to a server when interacting with elements on the page.See footnote 1
When showing a tab's contents...
Assuming the content of each tab generates quickly, you can make your application more efficient by only creating the content for the tab when it is requested the first time. This way, if the tab is never accessed no resources are used.
When hiding a tab's contents...
When working with multimedia you may need to perform additional actions when you hide content. For example, a video won't stop playing just because you hide it. For your audio application you may need to stop playback of the current sequence.
There are many tab controls available such as jQuery UI tabs (free) and Sliding Tabs (licensed but inexpensive).
Other Scenarios
Tabs should be used for switching between major blocks of content like documents (e.g. browser tabs) and/or regularly used functionality (e.g. a personnel form which has a tab for contact information and another for employment history). Other scenarios may be better suited to a dialog (modal or non-modal).
Using the audio example, if you had a button labeled "tempo", I would expect it to open a small dialog window on top of my current view rather than taking me to a new tab. Roland's workstation keyboards use this paradigm. Major content replaces the current view, but settings/configuration windows usually popup atop the existing view.
jQuery UI also has a dialog plugin for this purpose. If you are JavaScript savvy and targeting newer browsers, it's not that hard to write your own simple dialog.
1 Generating content on the fly may still be perfectly acceptable with an interactive client-server relationship, but it introduces additional considerations, such as the synchronization of what is in the browser with the data model on the server (if any), the submission of unneeded form fields (increasing the size of the request), overall page size, etc.
I would suggest checking out the JQuery UI library. More specifically, the tabs functionality that it provides, http://jqueryui.com/demos/tabs/.
Simple rule of thumb for loading data into your tabs. Small and Simple, load it up front. Large and Complex, load it on demand. When in doubt, load it on demand.
if you're looking for a complex UI, I recommend you check out Dojo or Ext JS. They both provide you with a UI framework closer to Java's Swing framework.
However, if you're looking for tabs, and tabs only, jQuery UI is great.
If you're working on a canvas, do your GUI on your canvas. Seriously. Using divs in front of a canvas is just boring. I tried both, and I prefer using canvas.
The easiest way is to create a "button" class which will take an image and define a clickable zone on your canvas for this image (if you want pixel-detect there is a way which uses offscreen canvas and getpixel to check colors under the mouse and stuff, too long to explain here).
Then once you have your button or whatever gui class, you can put them on your canvas and you won't have to manage multiple html elements.
Also, some html elements in front of a canvas often have weird behaviours. That's why I prefer creating my gui directly on the canvas. Harder at the beginning but proper.
Of and please, make it possible to place multiple squares without having to reclick (just use a mouseDown variable)
It looks like my problems never end with this site. I'm using jQuery to pull posts tagged "_featured" into the sidebar on a Tumblr blog. I have it calling the title of the text post along with the image included in it. Unfortunately, no matter what I try, this breaks the equal height columns on any page where the content column isn't longer than the sidebars.
I've tried different methods of achieving equal columns (I'm currently using The Equal Heights jQuery Plugin since I'm already using jQuery on the site. I've also tried the padding/negative margin trick and good ol' Faux Equal Columns using a background image. I figured it would be easy to solve it by using the jQuery plugin and wrapping the function call in a $(window).load(function(), but it's still hit or miss (mostly miss right now for some reason).
If anyone has any suggestions, please, save my computer from being thrown. The obvious solution that I'm thinking might work would be to have the JS calling the featured posts to also include the image size, but I'm not sure how I would do that.
The JS calling the featured posts can be viewed here and the site itself is at escapebadmusic.com.
Thanks again, everyone. I think I say this just about every time I post a question, but the help here has saved me a lot of time and frustration. It's always appreciated.
Try running EqualHeights after dom has finished changing.
(to be more specific - you should run EqualHeights after doc.ready, and after you add your image, or changed anything in the dom that affects heights)
I have some HTML documents that are converted to PDF, using software that renders using QtWebkit (not sure which version).
Currently, the documents have specific tags to split into columns and pages - so whenever the wording changes, it is a manual time-consuming process to move these tags so that the columns and pages fit.
Can anyone provide a way to have text auto-wrapped into the next column/page (as appropriate) when it reaches the bottom of the current container?
Any HTML, CSS or JS supported by QtWebkit is ok (assuming it works in the PDF converter).
(I have tested the webkit-column-* in CSS3 and it appears QtWebkit does not support this.)
To make things more exciting, it also needs to:
- put a header at the top of each page, with page X of Y numbering;
- if an odd number of pages, add a blank page at the end (with no header);
- have the ability to say "don't break inside this block" or "don't break after this header"
I have put some quick example initial markup and target markup to help explain what I'm trying to do.
(The actual documents are far more complicated than that, but I need a simple proof-of-concept before I attack the real ones.)
Any suggestions?
Update:
I've got a partially working solution using Aaron's "filling up" suggestion - I'll post more details in a bit.
Create a document with a single page and all the text in a single column. Use JavaScript to cut the text into parts.
Use pixel coordinates to locate the paragraph/element that doesn't fit anymore. Move it and everything below to the next col. If a "page" already has two "col" divs, start a new page.
After all pages have been created, count and number the pages. Fix even/odd stuff, etc.
Will take some time but it's automatic.
Another approach would be to add all the content to a "source" div and move items to the col div until it's full and repeat with the next col.
Have a look at Prototype or jQuery; they should give you lots of tools to move stuff around in the document.
[EDIT] Instead of only relying on jQuery functions, I suggest to create one or two objects which keep track of the current page and the current column, etc. These give you stable foundations to stand on from which you can fire the helper methods.
I want to have multiple video icons at the top my website's front page. I will have about 20 or so which won't fit on one line (I want to keep the videos on one like) so I thought of having two button on the right of the group and on the left of the group where you click to scroll and view more videos. Do you know an easy way to do this? I can pass in the video links from the server in different Divs or anyway that will make it easy. I thought of using AJAX and pass it different set every time from the server with every click (I'm using Rails and it's fairly easy to do it) but that will be an extra load on the server which I'm trying to avoid. I'd rather send all the icons at once and let the JavaScript handle the scrolling.
I thought of using iFrame but I don't like the idea of scrollbar and wanted to be more like button
Any ideas?
Thanks,
Tam
Use a JavaScript library like jQuery. There is myriad of plugins that do exactly what you want. Here is one