简体   繁体   中英

How can i replace text in html using jquery?

Im working with UIKit Css Framework for a website, in that for responsive mobile width, i have to increase the ratio of slideshow element when page is opened on specfic width(such as upon width of 640px or less). The HTML Code is like below :

<div class="slider-responsive uk-position-relative uk-visible-toggle uk-light" tabindex="-1"  uk-slideshow="ratio: 7:3;animation:push"

Upon the width of 640px and less I want to change the value of "ratio:7:3" to "ratio:7:6", how to achieve this in javascript or jquery ?

I guess this is what you want.

$(window).on('resize', function() {
  var width = $(window).outerWidth();

  if (width < 600) {
    $(".slider-responsive").attr("uk-slideshow", "ratio: 7:3;animation:push");
  } else {
    $(".slider-responsive").attr("uk-slideshow", "ratio: 7:6;animation:push");
  }

});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM