English 中文(简体)
使用一只带有任何 s子的 co子。 可能的话
原标题:using a cookie with anything slider. possibly ajax

我正在考虑撰写一部 co,每当新闻发行人向下个图像/新闻项目移动时都会更新。 当用户返回网页时,它将自动从下一个新闻项目开始滚动器,帮助确保我们的用户看到所有项目。

i am using the anything scroller by chris coyier et al, with php to pull in the news data.

每人

  • element has a unique id and are in numerical order so my cookie needs to retrieve the latest value and then +1 . the scroller allows for triggers to specific items.. but i can t seem to get the cookie to update on each, moreover it loads once the maximum id of those rendered in html...

    这甚至可行? 假设最多10个新闻项目,网站就会放慢。

    edit this is the could trying to get some output to the browser / console... but nothing.

           <script>
          // Set up Sliders
          // **************
          $(function(){
          $( #slider ).anythingSlider({
          theme :  minimalist-round ,
          easing :  swing ,
          infiniteSlides : true,
          delay : 8000, // How long between slideshow transitions in AutoPlay mode (in milliseconds)
          resumeDelay : 8000, // Resume slideshow after user interaction, only if autoplayLocked is           true (in milliseconds).
          animationTime : 1, // How long the slideshow transition takes (in milliseconds)
          autoPlayLocked : true, // If true, user changing slides will not stop the slideshow
          })
          $( #slider ).bind( slide_complete , function(event, slider){
          console.debug(  You are on page   + slider.currentPage );
          // Do something else
          })
          });
          </script>
    
  • 最佳回答

    解决办法:利用当地储存这一工程

      <script type="text/javascript">
      var ls = null, // local storage
      sp = 1;    // starting page
    
      if ( localStorage  in window && window[ localStorage ] !== null) {
      ls = window.localStorage;
      sp = ls.getItem( anythingSlider ) || 1;
    
      }
      </script>
    

    以及

      <script>
             $( #slider ).anythingSlider({
    
    startPanel: sp,
    // Callback when slide completes - no event variable!
    onSlideComplete: function(slider) {
        if (ls) {
            ls.setItem( anythingSlider , (slider.currentPage+1));
            $( .storage ).val(slider.currentPage);
        }
    }
     </script>
    
    问题回答

    暂无回答




    相关问题
    ajax login using httpRequest?

    I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

    Virtual Tour using sketch up, ajax, flash technologies

    I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

    How can i update div continuously

    I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...

    热门标签