arrow function + templatetag for title added
This commit is contained in:
parent
6f08f6dcfe
commit
a383f3ed04
0
itf/frontpage/templatetags/__init__.py
Normal file
0
itf/frontpage/templatetags/__init__.py
Normal file
29
itf/frontpage/templatetags/itftags.py
Normal file
29
itf/frontpage/templatetags/itftags.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
from django import template
|
||||
|
||||
register = template.Library()
|
||||
|
||||
'''
|
||||
Used to format titles in the front slider boxes
|
||||
|
||||
>>>format_title("Script Bank")
|
||||
>>>SCRIPT <b>BANK</b>
|
||||
|
||||
>>>format_title("Script-Bank")
|
||||
>>>SCRIPT-<b>BANK</b>
|
||||
'''
|
||||
|
||||
def format_title(value):
|
||||
v = value.strip()
|
||||
if v.find('-') != -1:
|
||||
splitter = "-"
|
||||
else:
|
||||
splitter = " "
|
||||
words = v.split(splitter)
|
||||
l = len(words)
|
||||
if l > 1:
|
||||
boldWord = "<b>" + words[l - 1] + "</b>"
|
||||
return (splitter.join(words[:l-1]) + splitter + boldWord).upper()
|
||||
else:
|
||||
return words[0].upper()
|
||||
|
||||
register.filter("format_title")
|
|
@ -22,6 +22,7 @@ $(function() {
|
|||
|
||||
$('#arrowLeft').mouseout(function() {
|
||||
clearInterval(slideInterval);
|
||||
slider.stop();
|
||||
});
|
||||
|
||||
$('#arrowRight').mouseover(function() {
|
||||
|
@ -33,6 +34,7 @@ $(function() {
|
|||
|
||||
$('#arrowRight').mouseout(function() {
|
||||
clearInterval(slideInterval);
|
||||
slider.stop();
|
||||
});
|
||||
|
||||
|
||||
|
@ -67,7 +69,10 @@ var ItfSlider = function(o) {
|
|||
var arrLeft = (0 - this.getLeft()) + (this.contentWidth - 10);
|
||||
console.log(arrLeft);
|
||||
this.rightArr.animate({'left': arrLeft + "px"});
|
||||
}
|
||||
};
|
||||
this.stop = function() {
|
||||
this.ul.stop();
|
||||
};
|
||||
};
|
||||
|
||||
ItfSlider.prototype.moveLeft = function(distance, speed) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user