Category Archives: jQuery - Page 2

Украсяване с jQuery

jquery Украсяване с jQueryЗдравейте, днес ще разгледаме как да правим красиви краища на HTML елементите. За целта ще използваме jQuery което е JavaScript библиотека за по-бърза работа със събития, ХТМЛ елементи и помага и за лесното добавяне на Ajax към проектите ни.

Ето как изглеждат няколко елемнта направени с jQuery и допълнителната библиотека на Mike Alsup
2 Украсяване с jQuery

За начало трябва да си изтеглим последна верися на jQuery. Тук има сравнително нова верися, която компресирана е с размер ~20kb!!
Ще ни трябва и библиотеката която прави специалните ъгли, нея можем да изтеглим от тук.

Какво трябва да направим:
1. Добавяме стилова декларация. Тук има малък tweak за Сафари, трябва изрично да декларираме фона на елемента който ще съдържа украсеният. Ако не го направим Сафари показва черен цвят:

body { font: Verdana,Arial,sans-serif; background: #FFFFFF;}div.demo { padding: 6px; background: #d7e7f6; color:#313131; font: verdana, arial, sans-serif; font-size:13px; font-weight:bold;}

2. Декларираме 2та JavaScript-а jquery-1.1.3.1.pack.js и jquery.corner.js (точно в тази последователност)

3. Добавяме скрипт който указва какво ще манипулираме при зарждането на документа. Така показваме че всеки елемент от клас демо ще бъде преобразен. Това е кратко написана функицята $(document).ready(), но за нея ще говорим повече друг път.

$(function(){$("div.demo").corner();});

4. Декларираме елемента който искаме да ‘украсим’

Списък с възможните стилове, ако не се укаже по подразбиране ефекта е round:
Round – $(this).corner();
Bevel – $(this).corner(“bevel”);
Notch – $(this).corner(“notch”);
Bite – $(this).corner(“bite”);
Cool – $(this).corner(“cool”);
Sharp – $(this).corner(“sharp”);
Slide – $(this).corner(“slide”);
Jut – $(this).corner(“jut”);
Curl – $(this).corner(“curl”);
Tear – $(this).corner(“tear”);
Fray – $(this).corner(“fray”);
Wicked – $(this).corner(“wicked”);
Sculpt – $(this).corner(“sculpt”);
Long – $(this).corner(“long”);
Dog Ear – $(this).corner(“dog”);
Dog2 – $(this).corner(“dog2″);
Dog3 – $(this).corner(“dog3″);

Препоръки
- Възможно е указването на размера на украсения край да става в пиксели: $(this).corner(“bevel 4px”);
- Възможно е да посочим само горните два ъгъла да са различни: $(this).corner(“bevel top”);
- Използвайте само px размери при указване на отстояние и граници.
- Не използвайте картинка за фон на парент елемента.
- За бързодействие намалете броя на използваните украсени елементи, както и размера им.
- Показани всички примери можете да видите тук

jQuery in 15 minutes

Simon Willison has posted a short presentation, jQuery in 15 minutes.
Here it is:

view original

jQuery 1.1.3: 800%+ Faster, still 20KB

jquery jQuery 1.1.3: 800%+ Faster, still 20KB

Today jQuery team released a speedy version 1.1.3 of the jQuery JavaScript library. The new release come with more than 80 bugfixes and 800%+ of speed improvements, in addition to some new features and enhancements. Highlights include:

  • Improved speeds, with DOM traversal over 800% faster than in 1.1.2.
  • A re-written event system, with more graceful handling of keyboard events.
  • A re-written effects system (with an accompanying fx test suite), featuring faster execution and better cross-platform support.

There are more enhancements planned for the next releases of jQuery. jQuery 1.1.4 is already planned for the end of July, and it will be the last release of the jQuery 1.1 branch. The next generation of jQuery will begin with the 1.2 release, planned for late August, and it will include more new features and enhancements as you can read in the 1.2 Roadmap.

Browser jQuery 1.1.2 jQuery 1.1.3 % Improvement
IE 6 4890ms 661ms 740%
Firefox 2 5629ms 567ms 993%
Safari 2 3575ms 475ms 753%
Opera 9.1 3196ms 326ms 980%
Average improvement: 867%

Additionally, we tested the improved code base against some of the other popular selector libraries, again with the SlickSpeed test suite.

Browser Prototype jQuery Mootools Ext Dojo
IE 6 1476ms 661ms 1238ms 672ms 738ms
Firefox 2 219ms 567ms 220ms 951ms 440ms
Safari 2 1568ms 475ms 909ms 417ms 527ms
Opera 9.1 220ms 326ms 217ms 296ms 220ms

A couple things to notice when looking at the speed suite results are that:

  • We’re over 800% faster than we were in jQuery 1.1.2.
  • We’re the fastest framework in the most popular browser, Internet Explorer 6.
  • We’re the only framework that doesn’t give incorrect results.
  • And all of this comes at no expense to you — jQuery is still the same 20KB that you’ve come to expect and enjoy.

read original

AjaxPro Beta with jQuery Support

Michael Schwarz has provided small example how to implement AJAXPro with jQuery and JSON support. Here are some valueable links and the actual code:

“I forgot to put the beta version online that will support jQuery and json.js from http://www.json.org. You can download the latest beta of the AjaxPro library at http://www.ajaxpro.info/download/jQueryAjaxPro.zip. The download currently includes only the .NET 2.0 library including a Visual Studio .NET 2005 Web Site project.

The C# AjaxMethod

I added a very simple AjaxMethod HelloWorld which will only return a string and get one argument. The reason is that I don’t have included the new JSON converters which will be ready in the next days.
[AjaxPro.AjaxMethod]
public static string HelloWorld(string s)
{
return “Hello ” + s + “!”;
}

view original