快捷搜索:  as  test  1111  test aNd 8=8  test++aNd+8=8  as++aNd+8=8  as aNd 8=8

伟德国际官方app下载安卓版_酒文化网进入



cssninjas是一个商业网站,本身便是做网页设计的,是以站点本身也设计的想当不错。

应用到的jQuery插件有:

* jQuery UI 1.6RC2 [Slider + Datepicker]

* sIFR v2.0.7

看代码:

Code From cssninjas.com

1/**//*

2 * Scripts

3 *

4 */

5var Engine = {

6 // external links

7 externalLinks : function(){

8 $('a[@rel*=external]').attr('target','_blank');

9 },

10 // mails

11 secureMails : function(){

12 $('a[@href^=mailto:]').each(function(){

13 var mail = $(this).attr('href').replace('mailto:','');

14 var replaced = mail.replace('/at/','@');

15 $(this).attr('href','mailto:'+replaced);

16 if($(this).text() == mail) $(this).text(replaced);

17 });

18 },

19 // headers

20 replaceHeaders : function(){

21 if(typeof sIFR == "function"){

22 sIFR.replaceElement("#content h1.a", named({sFlashSrc: "/fonts/claderon.swf", sColor: "#ffffff", sLinkColor: "#ffffff", sHoverColor: "#ffffff", sWmode: "transparent"}));

23 sIFR.replaceElement("#content h2.a", named({sFlashSrc: "/fonts/claderon.swf", sColor: "#ffffff", sLinkColor: "#ffffff", sHoverColor: "#ffffff", sWmode: "transparent"}));

24 sIFR.replaceElement("#content h3.a", named({sFlashSrc: "/fonts/claderon.swf", sColor: "#ffffff", sLinkColor: "#ffffff", sHoverColor: "#ffffff", sWmode: "transparent"}));

25 };

26 },

27 // shadow

28 headerShadow : function(){

29 var el = $('#header h2');

30 el.after('

'+ el.text() +'

');

31 },

32 // calculator

33 calculator : {

34 init : function(){

35 this.pages = 1;

36 this.done = false;

37

38 this.base = [];

39 this.subs = [];

40

41 this.prices();

42 this.create();

43 this.shortcuts();

44 this.triggers();

45

46 this.containerCurrency.eq(0).trigger('click');

47 },

48 // trigger the calculations and populate fields

49 evaluate : function(){

50 this.calculate();

51

52 this.containerPages.text(this.pages);

53 this.containerTotal.html(this.totalHTML);

54 this.containerOrder.attr('href',this.containerCheckout + '/' + this.pages + '/' + this.abbr);

55

56 if(this.done){

57 this.containerFormPrice.html(this.totalHTML);

58 this.containerFormPages.val(this.pages);

59 this.containerFormCurrency.val(this.abbr);

60 }

61 this.done = true;

62 },

63 // grabs the prices from html

64 prices : function(){

65 $('#calculator div.data ul li span.additional').each(function(i){

66 Engine.calculator.subs[i] = parseInt($(this).html());

67 });

68 $('#calculator div.data ul li span.first').each(function(i){

69 Engine.calculator.base[i] = parseInt($(this).html()) - Engine.calculator.subs[i];

70 });

71 },

72 // replaces prices with slider

73 create : function(){

74 var 伟德国际官方app下载安卓版code = '';

75

76 code += '

How many pages? 1

' + "\n";

77 code += '-�+' + "\n";

78 code += '

';

79 code += '

Total: 0

';

80 code += '

Change currency: € · ___FCKpd___1lt;/a> · £';

81 code += '

' + "\n";

82

83 $('#calculator div.data').after(code).remove();

84 },

85 // sets shortcuts

86 shortcuts : function(){

87 // shortcuts

88 this.containerPages = $('#calculator p.pages span');

89 this.containerLess = $('#calculator ul.slider li.less a');

90 this.containerMore = $('#calculator ul.slider li.more a');

91 this.containerCurrency = $('#calculator p.currency a');

92 this.containerTotal = $('#calculator p.total span');

93 this.containerOrder = $('#calculator p.checkout a');

94 this.containerCheckout = this.containerOrder.attr('href');

95

96 this.containerFormPrice = $('#order strong.price');

97 this.containerFormPages = $('#f-pages');

98 this.containerFormCurrency = $('#f-currency');

99 },

100 // calculate the price

101 calculate : function(){

102 var base = this.base[this.currency];

103 var page = this.subs[this.currency];

104 this.total = this.pages * page + base;

105 this.totalHTML = this.sign + '' + '' + this.total;

106 },

107 // add events

108 triggers : function(){

109

110 var parent = this;

111

112 // currency change

113 this.containerCurrency.click(function(e){

114 parent.currency = $(this).parent().find('a').index(this);

115 parent.sign = $(this).html();

116 parent.abbr = $(this).attr('href').substr($(this).attr('href').indexOf('#')+1);

117

118 $(this)

119 .addClass('active')//.blur()

120 .parent().find('a').not(this).removeClass('active');

121

122

123 parent.evaluate();

124 return false;

125 });

126

127 // less/more

128 this.containerLess.click(function(){

129 if(parent.pages expand')

169 .toggle(function(){

170 $(this)

171 .find('span').attr('class','collapse').html('collapse').end()

172 .next('dd').fadeIn();

173 },function(){

174 $(this)

175 .find('span').attr('class','expand').html('expand').end()

176 .next('dd').fadeOut();

177 });

178 },

179 // delicious link

180 deliciousAdd : function(){

181 $('#bookmarks li.delicious a').click(function(){

182 window.open('http://del.icio.us/post?v=4&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=700,height=400');

183 return false;

184 });

185 },

186 // order form

187 order : {

188 init : function(){

189 this.datepicker();

190 this.change();

191 this.templates();

192 this.validate();

193 },

194 datepicker : function(){

195

196 var d = new Date();

197 var day = d.getDay();

198 var interval = 3;

199 if(day > 2 && day ')

208 .keyup(function(){

209 var num = parseInt($(this).val());

210 if(num > 0){

211 if(num20){

240 Engine.calculator.pages = pages;

241 Engine.calculator.evaluate();

242 }

243 Engine.calculator.containerCurrency.eq(currency).trigger('click');

244

245 },

246 templates : function(){

247 templates = 1;

248 var cont = $('#f-template').parent();

249 cont.append(' ')

250 cont.find('img').click(function(){

251 var parent = $(this).parent('p');

252 if(parent.is(':animated')) return false;

253 parent.clone().insertAfter(parent).hide().fadeIn('slow')

254 .find('label').attr('for','template-'+templates).parent()

255 .find('input').attr('id','template-'+templates).val('').parent()

256 .find('img').remove();

257 templates++;

258 $(this).appendTo(parent.next('p'));

259 });

260 },

261 validate : function(){

262 Engine.errors = 0;

263 $('#order').submit(function(){

264 Engine.validation.clear($('#order'));

265 Engine.validation.check($('#f-name'),Engine.validation.required,'Please enter your name');

266 Engine.validation.check($('#f-email'),Engine.validation.email,'Please enter proper email address');

267 Engine.validation.check($('#f-project'),Engine.validation.required,'Please enter project name');

268 Engine.validation.check($('#f-pages'),Engine.validation.required,'Please enter pages count');

269 Engine.validation.check($('#f-notes'),Engine.validation.required,'Please enter project notes');

270 if(Engine.errors !== 0) return false;

271 $(this).find('button').attr('disabled','disabled').blur().animate({ opacity: 0.4 }, 500);

272 });

273 },

274 printout : function(){

275 $('#ordered p.print span').wrapInner('').find('a').click(function(){

276 window.print();

277 return伟德国际官方app下载安卓版 false;

278 });

279 },

280 upload : function(){

281

282 $('#upload-form').submit(function(){

283 $(this).find('p.submit button')

284 .attr('disabled','disabled')

285 .animate({opacity: 0.4},500)

286 .blur()

287 .parent().after('

Up伟德国际官方app下载安卓版loading files please wait

').parent().find('p.wait').fadeIn('slow');

288 $('#template').attr('disabled','disabled');

289 }).find('p.submit')

290 .before('Upload QueueNo files in queue yet')

291 .find('span').html('Upload Files').end()

292 .parent().find('h2.a').html('Insert your files');

293

294 $('#template').change(function(){

295 var path = $(this).val();

296 var file = path.split('\\');

297 file = file[file.length-1];

298

299 var count = $('input.offset[type=file]').size()+1;

300

301 $(this).clone().addClass('offset').attr('id','template-'+count).insertAfter($('input[type=file]:last'));

302 $(this).val('');

303

304 if(count (remove)').find('li:last').fadeIn(500).find('a').click(function(e){

308 e.preventDefault();

309 $($(this).attr('href')).remove();

310 $(this).parents('li').fadeOut(500,function(){

311 $(this).remove();

312 });

313 });

314 });

315

316 }

317 },

318 // contact form

319 contact : {

320 init : function(){

321 Engine.errors = 0;

322 $('#contact').submit(function(){

323 Engine.validation.clear($('#contact'));

324 Engine.validation.check($('#f-name'),Engine.validation.required,'Please enter your name');

325 Engine.validation.check($('#f-email'),Engine.validation.email,'Please enter proper email address');

326 Engine.validation.check($('#f-subject'),Engine.validation.required,'Please enter subject');

327 Engine.validation.check($('#f-message'),Engine.validation.required,'Please enter your message');

328 if(Engine.errors !== 0) return false;

329 $(this).find('button').attr('disabled','disabled').blur().animate({ opacity: 0.4 }, 500);

330 });

331

332 }

333 },

334 // validation methods

335 validation : {

336 clear : function(container){

337 Engine.errors = 0;

338 container.find('p.error').remove();

339 },

340 check : function(field,rule,message){

341 if(rule(field) === false){

342 field.parent().after('

'+ message +'

')

343 Engine.errors++;

344 }

345 },

346 required : function(field){

347 return !! $(field).val();

348 },

349 email : function(field) {

350 return /^[A-Z0-9._%+\-]+@[A-Z0-9.\-]+\.[A-Z]{2,6}$/i.test($(field).val());

351 }

352 },

353 // testimonials rotate

354 testimonials : {

355 init : function(伟德国际官方app下载安卓版){

356 if($('#testimonials').size() Previous testimonialNext testimonial')

364 container.find('ul.index').click(function(e){

365 if(container.find('div.item:animated').size() > 0) return false;

366

367 if(e.target.nodeName == 'A'){

368 visible = container.find('div.item:visible');

369

370 if(e.target.hash == '#prev'){

371 if(visible.prev('div.item').size() > 0){

372 var next = visible.prev('div.item');

373 } else {

374 var next = container.find('div.item:last');

375 }

376 } else if(e.target.hash == '#next') {

377 if(visible.next('div.item').size() > 0){

378 var next = visible.next('div.item');

379 } else {

380 var next = container.find('div.item:first');

381 }

382 }

383

384 visible.fadeOut('slow',function(){

385 next.fadeIn('slow');

386 });

387 //e.target.blur();

388 }

389 return false;

390 });

391 }

392 },

393 // go back link

394 goBack : function(){

395 $('span.go-back').each(function(){

396 $(this).wrap('').click(function(){

397 history.go(-1)

398 return false;

399 });

400 });

401 }

402}

403

404$(document).ready(function(){

405 Engine.externalLinks();

406 Engine.secureMails();

407 Engine.answersToggle();

408 Engine.deliciousAdd();

409 Engine.calculator.init();

410 Engine.order.init();

411 Engine.order.printout();

412 if(!$.browser.msie) Engine.order.upload();

413 //Engine.testimonials.init();

414 Engine.contact.init();

415 Engine.replaceHeaders();

416 Engine.headerShado伟德国际官方app下载安卓版w();

417 Engine.goBack();

418});

419document.write('');Notes:

1. 定义一个新的变量来保存本页面相关处置惩罚逻辑

1var Engine = {

2 // external links

3 externalLinks : function(){

4 $('a[@rel*=external]').attr('target','_blank');

5 },

6}

7

免责声明:以上内容源自网络,版权归原作者所有,如有侵犯您的原创版权请告知,我们将尽快删除相关内容。

您可能还会对下面的文章感兴趣: