Yii Framework Forum: Xflexslider - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Xflexslider more then one slider on page Rate Topic: -----

#1 User is offline   sergmoro1 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 15-November 12
  • Location:Russia, Tatarstan, Kazan

Posted 22 August 2013 - 03:04 AM

One slider works well, but if more then one works only last. Did somebody solve this problem?
0

#2 User is offline   sergmoro1 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 15-November 12
  • Location:Russia, Tatarstan, Kazan

Posted 22 August 2013 - 07:48 AM

bag - 1. all ids are equal on a page, 2. All triggers have the same name So, some changes:

When define slides you should define unique id. I did it like this

$defs[]=array('slides'=>$slides,'flexsliderOptions'=>$options,'htmlOptions'=>array('id'=>'flexslider_'.$position.$i)); 


Changes in XFlexSlider.php
public function run() { ... if(!isset($this->htmlOptions['id']))     $this->htmlOptions['id']=$this->getId();     //$this->htmlOptions['id']=self::DEFAULT_SLIDER_ID; ... } ... public function registerClientScript() { ... //trigger the slider $cs->registerScript(       'flexslider_trigger_'.$this->htmlOptions['id'],       '         $(window).load(function() {         $(\'#' . $this->htmlOptions['id'] . '\').flexslider(' . $param  . ');             ' . $js_thumb . '         });       ',       CClientScript::POS_END     );       }


That's work.


0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users