www.webdeveloper.com
Results 1 to 7 of 7

Thread: Calling a slideshow function in another jQuery script

Hybrid View

  1. #1
    Join Date
    Feb 2013
    Posts
    6

    Calling a slideshow function in another jQuery script

    Brothers and sisters,

    I have a problem:

    When I click "Edit" button, the slideshow should STOP.

    So I tried this:

    Edit button code (editor-plugin.js):

    Code:
        base.prototype.pre_edit_button = function() {
          var _this = this;
          return jQuery('<button>', {
            'class': 'fee-hover-edit',
            'html': FrontEndEditor.data.edit_text,
            'click': function(ev) {
              _this.last_mouse_pos = ev.pageY;
              return _this.start_editing();
            }
          });
              
            };
    Slideshow code (header.php):

    Code:
        <script type="text/javascript">
          jQuery(document).ready(function($) {
             $('#slideshow ul.slideshow').cycle({
                timeout: <?php echo $slideshowspeed;?>,  // milliseconds between slide transitions (0 to disable auto advance)
                fx:      '<?php echo $slide_transition;?>', // choose your transition type, ex: fade, scrollUp, shuffle, etc...            
                pager:   '#pager',  // selector for element to use as pager container
                pause:   1,	  // true to enable "pause on hover"
                pauseOnPagerHover: 1 // true to pause when hovering over pager link
            });
          });
        </script>

    And here's my try:

    Code:
        base.prototype.pre_edit_button = function() {
          var _this = this;
          return jQuery('<button>', {
            'class': 'fee-hover-edit',
            'html': FrontEndEditor.data.edit_text,
            'click': function(ev) {
              jQuery(document).ready(function($) {$('#slideshow ul.slideshow').cycle({ timeout: '100000' });});
              _this.last_mouse_pos = ev.pageY;
              return _this.start_editing();
            }
          });
        
        };
    But it didn't work :s

    Any ideas?

    Thanks!

  2. #2
    Join Date
    Mar 2009
    Location
    Wherever i lay my hat
    Posts
    180
    I am not sure, but .ready() is called after the DOM is loaded, so i would omit that part:

    Code:
    ...
              'click': function(ev) {
              jQuery('#slideshow ul.slideshow').cycle({ timeout: '100000' });
              _this.last_mouse_pos = ev.pageY;
    ...
    also, setting a cycle timeout to 100 seconds isn't really stopping it. Doesn't the API have a stop() or pause() method?

  3. #3
    Join Date
    Feb 2013
    Posts
    6
    yay, it's almost working!

    It's pausing now, but it always returns to the fist slide when I click Edit ._.

  4. #4
    Join Date
    Feb 2013
    Posts
    6
    And here's a pastebin with the full editor-min.js script:
    http://pastebin.com/g2ZAeDXB

  5. #5
    Join Date
    Feb 2013
    Posts
    11
    the idea of Jquery script is too much helpfull.
    Please give me the full tutorial of java and php links

  6. #6
    Join Date
    Mar 2009
    Location
    Wherever i lay my hat
    Posts
    180
    Well, i don't know why's that happening. I am not familiar with editor-plugin.js, but it appears to be something too difficult to touch. There should be some nice and easy to use API for that slideshow. Can't you post a live link to your test page or just zip the files and attach it here? Where did you learn the .cycle() method? There has to be a list of available methods somewhere. What's the name of it?

  7. #7
    Join Date
    Feb 2013
    Posts
    11
    YOUR idea is great but i think in the different we applied different coding either php coding or jquery script.
    but thanks for sharing with us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles