I have a nice javascript slideshow but it kills the rendering speed of my home page. According to Yahoo performance guru(s), javascript gets run before other stuff is rendered, so you fix that by putting the js code "at the end" of the html file.
Putting it at the end puts the slideshow at the bottom which is not the desired result. And even abs positioning is slave to the <div> structure.
How do I nullify the flow just for this one thing (I don't want to make the whole page absolute).
I've noticed that my site has been loading slower lately, especially in google images. I'm thinking that this could be due to the google analytics javascript. I was told that page load slows down if its placed on top (which I have). Is this true? I'm not really warming up to GA but I also don't want to nix it completely. Bottom placement doesn't work for me as GA does not record then.
I've been doing some research on javascript's impact on the time it takes for a page to load, as defined by firebug's "Net" tab's "onload" demarcation (the red line). It seems that aside from dynamic data that's not part of the HTML, enabling javascript always slows down the page. I've checked wikipedia, yahoo, digg, even google; a javascript-enabled loading of each site shows a later onload() event compared to loading the same site without javascript enabled. My question: Can anyone think of a site that loads faster with javascript than it does without javascript?
I am using the cycle plugin on the homepage of my website and it it taking 6.5s ish to fully load the page. All the elements are loaded in less than 1s but it takes 5s plus to render the final page. Is this a CSS issue or is there a better way of using the cycle plugin?
I am looking for a javascript function that can log the following information for each pageview:
1. The total page rendering time (not php script execution time, but the time at which the entire page is rendered from the user's perspective - all images loaded, ads served etc)
2. The URL of the page
3. The browser used to access the page
4. The country the page was accessed from
The script should then store the information in a database via an AJAX call after it's been collected.
It sounds like a tall order, but it will help me get a picture of how fast or slow my site feels depending on where you live (e.g. how far you are from the server), what browser you're using, and which pages are the slowest to render (keep in mind this is not script execution time or query time, but literally the time at which the page starts to render, to when it finishes rendering).
I have a JSON file with multiple containers that has built a webpage. I need to create a javascript from this file to render a page since it was written to use a js library (I think scriptaculous or doj). I want to use jQuery to do this -- at least that's what I'm told I can do. I understand that JSON is a data-exchange language like XML. Here's some code:
Code: var nov_info= { 'categories':[ {N:'nwItem1',O:'Composition',V:School Supplies > Paper> Notebooks}, {N:'nwItem2,O:'Crayons',V:'Elementary > Art > Art Supplies'}, {N:'nwItem3',O:'Calculators',V:'High School > College Prep> Trigonometry'}, {N:'nwItem4',O:'Maps',V:'Middle School > US History > Civil War'} ], [Code]....
I wrote a simple jQuery script to take a HTML list (ul and li elements) and add collapsing functionality. The problem is that when you click one of the items open and closed repeatedly, the execution gets slower and slower and eventually stops responding.
[Code]...
The list starts out fully expanded with a "+" next to each item that can be folded, which changes to a "-" after the folding is done. If a "-" is clicked, that item and all its children are expanded.
I have a strange problem that occurs in IE 7 and 8 and does not occur in Firefox or Safari.I'm dynamically adding class to a table row on a checkbox selection. A row contains some input fields that get enabled or disabled. If a row is enabled, it gets highlighted using selectedrow class. If it gets disabled, the class is removed:
I've recently started playing around with jQuery and the jquery-tmpl plugin. I've been fairly impressed with how easy it has been to get my sample apps to call a web service and populate the returned data using a template on my page using something like...
var rendered = $.tmpl("myNamedTemplate", data); $("#resultList").html(rendered);
What I'm currently having trouble understanding is how to get the html results of rendering a template into a string so I can use it with other APIs. I'm working with the Bing AJAX map control and various functions in it's API take HTML as a string parameter.
What I tried first...
var myHtmlTitle = $.tmpl("myTitleTemplate", data); pin.SetTitle(myHtmlTitle);
That didn't quite work like I expected and resulted in an exception from the BING map control. I quickly figured out that what .tmpl was returning was not a formatted HTML string, so it makes sense that would fail.
I then tried appending .html to things and I got close...
var myHtmlTitle = $.tmpl("myTitleTemplate", data).html(); pin.SetTitle(myHtmlTitle);
This did in fact return an HTML string, but the problem is it was stripping off the top-level tag in my template. It's acting like it's returning innerHTML of the top-level tag.
Is there an easy way to simply render the template to a string so I can pass that into the APIs?.
I am loading a list of answers give by a specific user into a tab panel. To do this I'm using the following code: $('#questionBody').load('dashboard/questions'); All the html elements not from a loop such as a header image show up fine but the list of answers looks like it's displayed similar to when you use print_r() on an array. Is load() the proper function to use here?
here's an example of the output: {"status":200,"data":{"questions":[],"params":{"page":false},"user_answers":{"13":{"flagged":"0","regdate":"1282869034","id":"13","qid":"9","body":"an answer of course...","payed":"1","question":{"id":"9","title":"test","body":"test","uid":"1586","permalink":"/question/view/9"},"status":"complete"},"11":
i am wondering, what is the best way to render HTML on a page using an ajax request that gets the data as an XML file?
Say for example you wanted to load the comments on a particular news post, and wanted to pull this data in via ajax, and you server returns an xml with the commens in it, for example:
[Code]...
and then take that xml file and use it to render a list of comments, with profile pictures (worked out from the `profile_id`). I ask as i can do this easy enough by just making the server return the output as HTML, then placing it inside a container for the comments, but this is slower as the html output would be much bigger in size then the xml output.
I also need the ability to add a callback function so i can make a popup display if there is an error, or run a function that does something after the data is loaded. Ideal'y id like to load the html template which i would use along side the xml file, via ajax, but this isnt completely neceserry.
I'm writing a blog. When a user clicks the make comment link under the comments section for a blog entry, a div pops up with the form that allows them to make a comment. I would like to use XMLHttpRequest to point to a php file that posts the comment, and then display the comment underneath the others that are already there...
This is my first real experience with Javascript in 8 or 9 years, and I've forgotten it almost entirely. I'm working off of tutorials that I'm finding here and there, and have already gotten the XMLHttpRequest to perform the posting of the comment, but I don't know how to write the comment to the end of the comments list without refreshing the page.. Code:
Is there a javascript or jQuery method available to force the browser to render the contents of the window? This would something similar to updating the "stage" in Director or Flash.I have a two-column interaction set up where users input information in one column and see their results in another. Safari, Firefox, etc all work perfectly. IE however needs an extra click anywhere on the browser window for the results to appear. So I'm looking for a way to attach a function to a UI control that 'forces' IE to render the screen so the changes appear.
I am trying to find how to use custom tags in html and render data based on their use.
A good example is the joomla <jm:whatever> tag.
I found the following article: [url]
I think it might be outdated though because the behavior:url element does not seem to work. Plus, when I check the style sheet on a joomla site, it doesnt seem to use this method. I think these tags might be xml but I do not know how to render them based on the tag.
For example: <customAbbrv:display src="test.html" label="Test" />
I would want this tag to fire test.html and pass the attribute label which is set to Test.
I need to move the entire contents of one div to a sibling div. At present I'm just doing (assuming the 2 divs are called 1st and 2nd):
What I need to know is if this is the quickest means (in performance terms) of doing this as I will be performing the operation regularly and on a large number of nodes and it's in an area where the UX really can't stutter ?
I have some code which creates an extremely long table row, and I've been able to clean it up to a point where my performance is fairly decent. What I am trying to figure out is if its better in terms of speed to use divs as opposed to the really long table row. I didn't really find much on this topic online, so thought I'd ask out here.
I have read many of the copius entries on the subject of IE performance (or the lack thereof) when populating Select Lists.
I don't mind the insert performance so much, (I get 100x120byte rows inserted/sec up to 500, and 100rows/6secs up to 3000, which isn't great but then the Row Count is clicking away for the user to see and they can hit the "cancel" button at anytime, so overall I'm happy), what really disappoints me is the woeful of .REMOVE()!
Before fetching the next result-set I clear down the existing options (I *do* have to do this don't I?) by looping through option collection calling remove(1). (Would it be quicker if I removed the last option? Option[0] is a header.) For 3000 rows this takes an unbelievable 20+secs :-( Does this sound about right?
1) Is it only IE that performs badly on this?
2) Is there a quicker or more efficient way of zeroing the Select List?
2a) The w3schools ref says the "length" attribute "Returns the number of options in a dropdown list" it doesn't say "sets Or returns"
2b) The French guy (Stephane?) suggested that I should just set the length to zero, but wouldn't that result in a memory leak?
3) Do I need to create a malloc/realloc function that keeps a high-water mark of available option objects for this Drop Down and only "new" some more options when that's exceeded? (But then the Length would always be off)
I just tested all my jQuery selectors using the jQuery Tester [url], and the results seem to "contradict" one thing I read in a performance article: that you should descend from the closest parent ID when using classes in your selector (the article says "April 09", so the latest jQuery version was already available). In my tests, using just the class selector (like span.myClass) was always fastest (sometimes twice as fast as #myDiv span.myClass), and this in all browsers I tested, not just the ones supporting getElementsByClassName. Maybe descending from the closest parent ID becomes a factor when you have a lot of elements on you page?
I pull XML from server using .load() and then iterate with .each() over some 3000 nodes. I use .find() to get 7 sub-nodes and store them internally (into arrays). It works, but it is disappointingly slow. On my obsolete P4 it can take 8-10 seconds during which the whole browser (FF) is completely frozen. On faster computers the processing time is shorter, but still way too long. What can I do to cut this time? I certainly need speed up of an order, two orders would be nice. Would JSON be any faster? Or should I pull text/plain in custom format and parse it in my JS code?
I have a php search page with can potentially display several hundred records. For each record, there is an icon which, when clicked, makes an ajax call. When the reply comes back, the text returned from the server script is added to a specific div and the source of the icon that the user clicked is changed (as a visual cue that that particular item was selected).
This works 100% perfect in FireFox (3.5.9), Chrome, and IE 7. However when I test it in IE 8 there is a HUGE lag between when the icon is clicked and when the div and icon are updated (usually between 10-15 seconds). By commenting out one line at a time, I've narrowed it down to the line that changes the src attribute of the icon...if I just comment that line out, the ajax call is made and the div is updated instantaneously.