Forum Replies Created
- Not sure how to address your first point. We are talking about this implementation of the theme and what makes the rendering performance poor, right? The cached result dropped to ~1s for me, so that’s a pretty obvious hint that the downloading of resources is a problem
- For mobile, I would either get rid of a lot of images completely, or make sure that smaller images are served and not the huge ones. Not sure if that background effect is useful on a smartphone anyway? And generally, consider serving assets from a CDN
Not sure what you mean by that last sentence either. If the number of plugins have a negative effect on performance, why is that not relevant? And what do you mean by the theme itself? Perhaps I am misunderstanding. :)
Opening the Network tab in Chrome dev-tools, we can see that there are 127 requests being made with a grand total of 5.3MB. Maybe start there? :) background2.png took almost 13s to load for me right now. You need to do something about that.
How are you planning to optimize this for mobile devices? It seems that you are loading the same resources there too? That same background image takes about half a minute to download on a 3G network. I sure wouldn’t want to visit that site using a smartphone..
There are several other images that are quite large. Try to optimize, lazy load or remove them.
The Google Map is loading a lot of image resources, it seems. Maybe you could hold the map loading until the user is actually anywhere near it?
There might be other pain points. This was just the most obvious problem that I saw just glancing at the site.
You are pretty close. The part where you fade in the next slide also needs to be within the callback of the previous slide’s fadeOut function. Check out this pen:
Something like this? You need to pass a callback function for when the fade out function has finished. In my example, I toggle a couple of classes and then begin fading in.
Even without knowing how your HTML and CSS looks, I would not recommend using document.write:
The return value you get when calling
john.askTeller()is a function itself, which is why you first store it in
myBalanceMethod. You could call it directly by doing
john.askTeller()()but that’s a bit weird.
I’m not sure what the restrictions of this particular course are, but instead of askTeller returning
return returnBalance;you could instead return the result of it:
return returnBalance();. But again, I don’t know if that would violate what the course is trying to teach you.
If you find yourself doing this a lot, then you might want to use something like jRespond:
I think you need to define a file pattern within the watch task. So if you just want to watch any file within the images folder, you would do
files: ['images/*']or if you have sub folders you can do it recursively with
It is because you are doing
setMarkersfunction. So the map will center on every marker, which is why in the end it centers on USA, because that’s the last marker being added.
Just remove that line from
setMarkersand it will center correctly.September 5, 2014 at 1:08 am in reply to: I can't figure out why a JS text scroller isn't working. #181770
One potential problem is that you are not specifying a unit (px, em, % etc.) for the top property. But in general though, the solution looks pretty dated. :) Take a look at this code, I cleaned it up a bit for you. It is by no means perfect but it could serve as a starting point perhaps.
You could also use something like Velocity.js.September 4, 2014 at 5:57 am in reply to: I can't figure out why a JS text scroller isn't working. #181634
Maybe first explain how it should work? :)
checked it via if (sum!== ‘NaN’)
'NaN'is a string,
NaNis a number if you check it using
NaN === NaNturns out to be
falsewhich is confusing and f*cked up but we can use
isNaN()to avoid that.
However, I don’t think I would have solved it that way. Assigning NaN to a variable seems weird I think.
You are not checking the sum for
NaN,you are checking it for
''(empty string). So you could replace
if (sum !=='')with
if (!isNaN(sum))and it would work.