40 $this->
widget = new \YAWK\widget();
62 public function init()
65 if (!isset($this->contentAnimatorClass) || (empty($this->contentAnimatorClass)))
67 $this->contentAnimatorClass =
"fadeIn";
70 if (!isset($this->contentAnimatorScrollValue) || (empty($this->contentAnimatorScrollValue)))
72 $this->contentAnimatorScrollValue = 600;
75 if (!isset($this->contentAnimatorInfinite) || (empty($this->contentAnimatorInfinite)))
77 $this->contentAnimatorInfinite =
"";
81 if ($this->contentAnimatorInfinite ===
"true")
83 $this->contentAnimatorInfinite =
"infinite";
87 $this->contentAnimatorInfinite =
"";
95 echo
"<link rel=\"stylesheet\" type=\"text/css\" href=\"system/widgets/contentAnimator/animate.css\">";
101 $(document).ready(function(){
102 // Slide in elements on scroll
103 $(window).scroll(function() {
104 // on each element that go animate class
105 $('.animate').each(function()
108 var pos = $(this).offset().top;
109 // get window top position
110 var winTop = $(window).scrollTop();
112 // user-defined params for every element
113 // if they are not filled, default widget settings will be used
114 var fx = $(this).attr(\"data-fx\"); // animation fx for this element
115 var px = $(this).attr(\"data-px\"); // px value from top for this element
117 // check if custom px value is defined
118 if (px !== undefined) {
119 // set custom px value
120 contentAnimatorScrollValue = px;
123 // set default px value from widget settings
124 contentAnimatorScrollValue = $this->contentAnimatorScrollValue;
127 // animate when position is in visible area
128 if (pos < winTop + contentAnimatorScrollValue) {
129 // $(this).velocity(\"transition.fadeIn\", {duration:1000, loop:false});
131 // element got custom FX values
132 if (fx !== undefined) {
133 // set animated custom fx
134 $(this).addClass('animated '+fx);
135 // remove animate class to avoid hide after animation
136 $(this).removeClass('animate');
139 { // add default fx from widget settings
140 $(this).addClass(\"$this->contentAnimatorClass\");
Add a pre-defined effect to any of your content elements.
__construct($db)
Load all widget settings from database and fill object.
init()
Initialize: prepare proerties and load javascript.
printObject()
Print all object data.
$contentAnimatorScrollValue
if(isset($_POST['save'])) $settings