Home >Backend Development >PHP Tutorial >PHP development framework Yii Framework tutorial (39) Zii component-Slider example

PHP development framework Yii Framework tutorial (39) Zii component-Slider example

黄舟
黄舟Original
2017-01-22 10:04:201266browse

CJuiSlider displays a slider that can be used to zoom images or use other functions. It encapsulates the JUI slider plug-in.

This example uses CJuiSlider to scale an image:

<?php $this->widget(&#39;zii.widgets.jui.CJuiSlider&#39;, array(  
    &#39;value&#39;=>50,  
    &#39;options&#39;=>array(  
                &#39;min&#39;=>1,  
                &#39;max&#39;=>100,  
                &#39;slide&#39;=>&#39;js:  
            function(event,ui){  
                $("#image").width(648*ui.value/100);  
                $("#zoom").text(ui.value+"%");  
            }  
        &#39;,  
                ),  
            &#39;htmlOptions&#39;=>array(  
                &#39;style&#39;=>&#39;width:648px; float:left;&#39;  
                ),  
)); ?>  
  
<div id="zoom" >50%</div>  
<br />  
  
<img  id="image"    style="max-width:90%" src="images/harry.jpg" alt="PHP development framework Yii Framework tutorial (39) Zii component-Slider example" >
<?php $this->widget(&#39;zii.widgets.jui.CJuiSlider&#39;, array(  
    &#39;value&#39;=>50,  
    &#39;options&#39;=>array(  
                &#39;min&#39;=>1,  
                &#39;max&#39;=>100,  
                &#39;slide&#39;=>&#39;js:  
            function(event,ui){  
                $("#image").width(648*ui.value/100);  
                $("#zoom").text(ui.value+"%");  
            }  
        &#39;,  
                ),  
            &#39;htmlOptions&#39;=>array(  
                &#39;style&#39;=>&#39;width:648px; float:left;&#39;  
                ),  
)); ?>  
  
<div id="zoom" >50%</div>  
<br />  
  
<img  id="image"    style="max-width:90%" src="images/harry.jpg" alt="PHP development framework Yii Framework tutorial (39) Zii component-Slider example" >

PHP development framework Yii Framework tutorial (39) Zii component-Slider example

The above is the content of the PHP development framework Yii Framework tutorial (39) Zii component-Slider example , for more related content, please pay attention to the PHP Chinese website (www.php.cn)!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn