Need to perfect your website? Try these: google pagespeed
yslow
It's a great way to tweek your site for better browsing experiances for your users.
More tools to simplify and optimize your code:
google closure
yuicompressor
minify
Tuesday, May 14, 2013
Wednesday, May 8, 2013
jquery not firing
So I had this issue before where when a page loads the jquery script would not fire for other function displays like tabs.
Why is that?
Well there was one answer I had which was using .on() but this only fires when an event is triggered, like mouse clicks, etc. In this case it was in the jquery tabs. The script would show on the first tab but not show in the others.
What to do?
The task was in each tab there was a condition, and if met an image would display. Theoretically the condition should work for each tab (which is a mvc page view) but the issue was that the condion written was too general. So when it became more specific the code was then fired.
The condition took the first tag for the entire loaded view but not run each script for each pageview.
eg,
$("#A #B").addClass('something');
$("#C #B").addClass('something');
$("#D #B").addClass('something');
rather than
$("#B").addClass('something');
Why is that?
Well there was one answer I had which was using .on() but this only fires when an event is triggered, like mouse clicks, etc. In this case it was in the jquery tabs. The script would show on the first tab but not show in the others.
What to do?
The task was in each tab there was a condition, and if met an image would display. Theoretically the condition should work for each tab (which is a mvc page view) but the issue was that the condion written was too general. So when it became more specific the code was then fired.
The condition took the first tag for the entire loaded view but not run each script for each pageview.
eg,
$("#A #B").addClass('something');
$("#C #B").addClass('something');
$("#D #B").addClass('something');
rather than
$("#B").addClass('something');
Friday, April 26, 2013
indexed png .. how to edit?
I had no trouble working with gradient black to transparent images using fireworks but when I was working with images white to transparent it didn't not work. It would solidify the transparent whites. ugly.
There is a solution here alpha-transparency-in-indexed-png-images
But here's my work around using both fireworks and photoshop.
1. Open the image in fireworks. Do your editing.
2. When done save the image as fireworks png.
3. Open your image in ps.
4. Save your image with "save for web and devices" choose png-24.
It'll increase your file size a bit more than the original for me it was less than double but still under 10kb. I will test more with png-8
There is a solution here alpha-transparency-in-indexed-png-images
But here's my work around using both fireworks and photoshop.
1. Open the image in fireworks. Do your editing.
2. When done save the image as fireworks png.
3. Open your image in ps.
4. Save your image with "save for web and devices" choose png-24.
It'll increase your file size a bit more than the original for me it was less than double but still under 10kb. I will test more with png-8
Wednesday, April 24, 2013
learning... jquery bind events
list of jquery bind events
blur, focus, focusin, focusout, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error
credits to jquery4u
blur, focus, focusin, focusout, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error
credits to jquery4u
Tuesday, April 9, 2013
Learning MVC4
Decided to learn mvc4. Started with nerddinner only to find out it doesn't translate to mvc4 (i should have started the project mvc3). Anyway found a shorter tutorial intro-to-aspnet-mvc-4 it's good. Just gives a very basic sample and all the new functions in MVC4 in VS2012. Now i just need to understand coding.
Model Controller View. So that the developer side is separate from the designer side, that is they can work on their respected areas without interfering with the other.
also CRUD.. the power of scaffolding create, read, update and delete
Model Controller View. So that the developer side is separate from the designer side, that is they can work on their respected areas without interfering with the other.
also CRUD.. the power of scaffolding create, read, update and delete
Thursday, April 4, 2013
jquery and javascript syntax - double quote or single quote?
I have always wonder which was a better choice for when writing string type codes. For example, $("hi") or $('hi)
Answer: It doesn't matter. However if you have a string statement that contains quotes you would need to use both single and double to contain the string. Using this method you would not need to use special codes for those symbols.
eg,
error
'today's special'
no error
"today's special"
'she said "boom"'
Subscribe to:
Posts (Atom)