www.webdeveloper.com
Results 1 to 4 of 4

Thread: Removing Slideshow elements form html file

Hybrid View

  1. #1
    Join Date
    Jan 2014
    Posts
    7

    Removing Slideshow elements form html file

    Hi.

    I have changing some things in a slideshow and need your help.

    In the html, I have this class:

    Code:
    <div class="element" data-animate="slideAppearRightToLeft" data-delay="800" data-length="300">First Title</div>
    And this code in the javascript file:

    Code:
        $.fn.responsiveSlider.animations = {
          slideAppearRightToLeft: function($caption, delay, length) {
            var animate, css;
            if (delay == null) {
              delay = 0;
            }
            if (length == null) {
              length = 300;
            }
            css = {
              'margin-left': 100,
              'margin-right': -100
            };
            $caption.css(css);
            animate = function() {
              css = {
                'margin-left': 0,
                'margin-right': 0,
                'opacity': 1
              };
              return $caption.animate(css, length);
            };
            if (delay > 0) {
              return setTimeout(animate, delay);
            } else {
              return animate();
            }
          },
    Is there any way to remove the atributes in the class and put them in the javascript file.

    I have tried by myself just to collect a series of errors and failures.

    Best regards.

  2. #2
    Join Date
    Mar 2012
    Posts
    202
    I'm assuming you're looking to specify the attributes in the JavaScript file. Since you're using jQuery, this example should work:

    Code:
    $caption.attr('data-delay','800');
    If you're actually looking to create the element with JavaScript instead, I suggest you look at this page.
    Last edited by Gray1989; 01-24-2014 at 09:40 PM.

  3. #3
    Join Date
    Jan 2014
    Posts
    7
    The idea is to remove all the atributes in the class and leave like this:

    <div class="element">First Title</div>

    Creating than the animate effect in the Javascript file.

  4. #4
    Join Date
    Mar 2012
    Posts
    202
    Yeah then my suggestion should work

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