当前位置: 首页 > 工具软件 > easy-tips > 使用案例 >

jquery ajax tips,javascript - jQuery Tips and Tricks - Stack Overflow

沈飞跃
2023-12-01

Speaking of Tips and Tricks and as well some tutorials. I found these series of tutorials (“jQuery for Absolute Beginners” Video Series) by Jeffery Way are VERY HELPFUL.

It targets those developers who are new to jQuery. He shows how to create many cool stuff with jQuery, like animation, Creating and Removing Elements and more...

I learned a lot from it. He shows how it's easy to use jQuery.

Now I love it and i can read and understand any jQuery script even if it's complex.

Here is one example I like "Resizing Text"

1- jQuery...

$(function() {

$('a').click(function() {

var originalSize = $('p').css('font-size'); // get the font size

var number = parseFloat(originalSize, 10); // that method will chop off any integer from the specified variable "originalSize"

var unitOfMeasure = originalSize.slice(-2);// store the unit of measure, Pixle or Inch

$('p').css('font-size', number / 1.2 + unitOfMeasure);

if(this.id == 'larger'){$('p').css('font-size', number * 1.2 + unitOfMeasure);}// figure out which element is triggered

});

});

2- CSS Styling...

body{ margin-left:300px;text-align:center; width:700px; background-color:#666666;}

.box {width:500px; text-align:justify; padding:5px; font-family:verdana; font-size:11px; color:#0033FF; background-color:#FFFFCC;}

2- HTML...

Larger |

Smaller

In today’s video tutorial, I’ll show you how to resize text every time an associated anchor tag is clicked. We’ll be examining the “slice”, “parseFloat”, and “CSS” Javascript/jQuery methods.

Highly recommend these tutorials...

 类似资料: