bobby-1 0 Posted February 18, 2012 Report Share Posted February 18, 2012 делал как описано тут выдает такую ошибку Parse error: syntax error, unexpected '(', expecting T_VARIABLE or '$' in /home/namsvetlo/israelcare.ru/docs/templates/vamshop/javascript/general.js.php on line 24 Вот мой код: <?php /* ----------------------------------------------------------------------------------------- $Id: general.js 899 2007-02-06 20:14:56 VaM $ [/b] [b] VaM Shop - open source ecommerce solution http://vamshop.ru http://vamshop.com[/b] [b] Copyright (c) 2007 VaM Shop ----------------------------------------------------------------------------------------- based on: (c) 2004 xt:Commerce (general.js,v 1.1 2004/03/17); xt-commerce.com [/b] [b] Released under the GNU General Public License ---------------------------------------------------------------------------------------*/[/b] [b] // this javascriptfile get includes at every template page in shop, you can add your template specific // js scripts here[/b] [b]function theRotator() { //Set the opacity of all images to 0 $('div.rotator ul li').css({opacity: 0.0}); //Get the first image and display it (gets set to full opacity) $('div.rotator ul li:first').css({opacity: 1.0}); //Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds setInterval('rotate()',6000); } function rotate() { //Get the first image var current = ($('div.rotator ul li.show')? $('div.rotator ul li.show') : $('div.rotator ul li:first')); if ( current.length == 0 ) current = $('div.rotator ul li:first'); //Get next image, when it reaches the end, rotate it back to the first image var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div.rotator ul li:first') :current.next()) : $('div.rotator ul li:first')); //Un-comment the 3 lines below to get the images in random order //var sibs = current.siblings(); //var rndNum = Math.floor(Math.random() * sibs.length ); //var next = $( sibs[ rndNum ] ); //Set the fade in effect for the next image, the show class has higher z-index next.css({opacity: 0.0}) .addClass('show') .animate({opacity: 1.0}, 1000); //Hide the current image current.animate({opacity: 0.0}, 1000) .removeClass('show'); }; $(document).ready(function() { //Load the slideshow theRotator(); $('div.rotator').fadeIn(1000); $('div.rotator ul li').fadeIn(1000); // tweek for IE }); </script>[/b] [b]?>[/b] [b][/CODE][/b] помогите разобратьтся что я делаю не так, я в этом абсолютный новичок сайтом занимаюсь от силы 2 недели Link to post Share on other sites
YuraS 4 Posted February 18, 2012 Report Share Posted February 18, 2012 этот код <script type="text/javascript"> function theRotator() { //Set the opacity of all images to 0 $('div.rotator ul li').css({opacity: 0.0}); //Get the first image and display it (gets set to full opacity) $('div.rotator ul li:first').css({opacity: 1.0}); //Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds setInterval('rotate()',6000); } function rotate() { //Get the first image var current = ($('div.rotator ul li.show')? $('div.rotator ul li.show') : $('div.rotator ul li:first')); if ( current.length == 0 ) current = $('div.rotator ul li:first'); //Get next image, when it reaches the end, rotate it back to the first image var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div.rotator ul li:first') :current.next()) : $('div.rotator ul li:first')); //Un-comment the 3 lines below to get the images in random order //var sibs = current.siblings(); //var rndNum = Math.floor(Math.random() * sibs.length ); //var next = $( sibs[ rndNum ] ); //Set the fade in effect for the next image, the show class has higher z-index next.css({opacity: 0.0}) .addClass('show') .animate({opacity: 1.0}, 1000); //Hide the current image current.animate({opacity: 0.0}, 1000) .removeClass('show'); }; $(document).ready(function() { //Load the slideshow theRotator(); $('div.rotator').fadeIn(1000); $('div.rotator ul li').fadeIn(1000); // tweek for IE }); </script> [/CODE] надо добавлять после [color=#ff0000][b][size=5]?>[/size][/b][/color] Link to post Share on other sites
bobby-1 0 Posted February 18, 2012 Author Report Share Posted February 18, 2012 этот код <script type="text/javascript"> function theRotator() { //Set the opacity of all images to 0 $('div.rotator ul li').css({opacity: 0.0}); //Get the first image and display it (gets set to full opacity) $('div.rotator ul li:first').css({opacity: 1.0}); //Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds setInterval('rotate()',6000); } function rotate() { //Get the first image var current = ($('div.rotator ul li.show')? $('div.rotator ul li.show') : $('div.rotator ul li:first')); if ( current.length == 0 ) current = $('div.rotator ul li:first'); //Get next image, when it reaches the end, rotate it back to the first image var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div.rotator ul li:first') :current.next()) : $('div.rotator ul li:first')); //Un-comment the 3 lines below to get the images in random order //var sibs = current.siblings(); //var rndNum = Math.floor(Math.random() * sibs.length ); //var next = $( sibs[ rndNum ] ); //Set the fade in effect for the next image, the show class has higher z-index next.css({opacity: 0.0}) .addClass('show') .animate({opacity: 1.0}, 1000); //Hide the current image current.animate({opacity: 0.0}, 1000) .removeClass('show'); }; $(document).ready(function() { //Load the slideshow theRotator(); $('div.rotator').fadeIn(1000); $('div.rotator ul li').fadeIn(1000); // tweek for IE }); </script> [/CODE] надо добавлять после [color=#ff0000][b][size=5]?>[/size][/b][/color] в таком случае весь этот код появляется над шапкой главной страницы http://israelcare.ru/ Link to post Share on other sites
bobby-1 0 Posted February 18, 2012 Author Report Share Posted February 18, 2012 спасибо разобрался надо было добавить открытие скрипта я так понимаю<script type="text/javascript"> Link to post Share on other sites
bobby-1 0 Posted February 18, 2012 Author Report Share Posted February 18, 2012 все получилось но есть одно но-почему то этот ротатор отображается с отступом слева около 10 пикселей не могу его сдвинуть влево вот код стиля /* banner rotator */ div.rotator {position:relative;height:240px;} div.rotator ul li {float:left;position:absolute;list-style: none;} div.rotator ul li.show {z-index:500;} [/CODE] Link to post Share on other sites
YuraS 4 Posted February 18, 2012 Report Share Posted February 18, 2012 наверное, надо отступ сделать 0 px div.rotator ul li {float:left;position:absolute;list-style: none; margin:0px; padding:0px;} Link to post Share on other sites
bobby-1 0 Posted February 18, 2012 Author Report Share Posted February 18, 2012 не помогло, идиотизм блин какой-то....есть еще какие нибудь предложения? Link to post Share on other sites
bobby-1 0 Posted February 18, 2012 Author Report Share Posted February 18, 2012 вопрос решился так div.rotator {;left:-40px;position:relative;height:340px;} div.rotator ul li { float:left; position:absolute; list-style:none; padding-top: 0px; } div.rotator ul li.show {z-index:500;} [/CODE] Link to post Share on other sites
aaviktorov 0 Posted April 27, 2014 Report Share Posted April 27, 2014 Всем добрый день уже давно успешно добавил этот ротатор на демоверсию 1.7, пеперь перенес на 1.72, но там не хочет работать. Все добавленные баннеры вышли друг под другом и появляются поочереди- 1-й ряд, второй, и т.п. а не пролистываются на одном места. Похоже я чтото пропустил, но не могу найти что и где перенес в файлы шаблона: 1. в main_content.html <div class="rotator"> <ul> <li class="show"> <a href="ссылка"> <img src="банер.jpg" width="725" height="250" alt="pic1" /> </a> </li> и далее банер2 и т.п. 2. в stylesheet.css: div.rotator {position:relative;height:250px;} div.rotator ul li {float:left;position:absolute;list-style: none;} div.rotator ul li.show {z-index:500;} 3. ну и код в general.js.php может еще чтото требуется или в новой версии 1 в 1 не работает? Link to post Share on other sites
support 447 Posted April 27, 2014 Report Share Posted April 27, 2014 Попробуйте другой ротатор, может он просто не совместим с новой версией jQuery. Полно ведь подобных скриптов готовых, вполне можно найти подходящий. Link to post Share on other sites
YuraS 4 Posted April 27, 2014 Report Share Posted April 27, 2014 я использую Nivo Slider http://nivo.dev7studios.com работает отлично. Link to post Share on other sites
Recommended Posts