jollyness.js
1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
jQuery(document).ready(function($) {
$('.dexp-container').find('.block-big-title').wrap('<div class="container">');
$('.search-icon').click(function(){
$(this).parent().find('.search-wrapper').show(0,function(){
$(this).parent().find('.search-wrapper').find('input[type=text]').focus();
});
});
$('.search-close').click(function(){
$(this).closest('.search-wrapper').hide(0);
});
// Auto clear default value field
$('.form-text,.form-textarea').cleardefault();
// Tooltips
$('.bs-example-tooltips').tooltip({
selector: "[data-toggle=tooltip]",
container: "body"
});
$('.dtooltip').tooltip({
container: 'body'
});
$("#bs-example a").popover();
$(".stat-count").each(function() {
//alert('ok');
$(this).data('count', parseInt($(this).html(), 10));
$(this).html('0');
count($(this));
});
//Go to top
$(window).scroll(function(){
if($(this).scrollTop() > 100) {
$('#go-to-top').css({
bottom:"25px"
});
} else {
$('#go-to-top').css({
bottom:"-100px"
});
}
});
$('#go-to-top').click(function(){
$('html, body').animate({
scrollTop: '0px'
}, 800);
return false;
});
//Masonry hover on ipad
$('.dexp-masonry-item').hover(function(){
$(this).find('.portfolio-item-inner').trigger('hover');
});
});
function count($this) {
var current = parseInt($this.html(), 10);
current = current + 1; /* Where 50 is increment */
$this.html(++current);
if (current > $this.data('count')) {
$this.html($this.data('count'));
} else {
setTimeout(function() {
count($this)
}, 50);
}
}
jQuery.fn.cleardefault = function() {
return this.focus(function() {
if (this.value == this.defaultValue) {
this.value = "";
}
}).blur(function() {
if (!this.value.length) {
this.value = this.defaultValue;
}
});
};