Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript JS For CSS

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #147953
    Anonymous
    Inactive

    Hello everyone, I wrote responsive design in HTML 5 & CSS 3 and wanted to make responsive logo too, when browser will be resized logo text size will be automatically changed and wrote this code in js, I’m interested about my code this is true way for fixing this problem? or are other ways for fixing this?

    My Code: function doResponsive() {
    var window_width = $(window).width();
    var slider_text = $("#slider > text");
    slider_text.css({
    'font-size' : parseInt(window_width / 10)-30+'px',
    'padding' : parseInt(window_width / 10)-50+'px' + ' 20px'
    });
    if (parseInt(slider_text.css('font-size')) < 35) {
    slider_text.css('display', 'none');
    } else {
    slider_text.css('display', 'block');
    if (parseInt(slider_text.css('font-size')) > 100)
    slider_text.css('font-size', '100px');
    if (parseInt(slider_text.css('padding')) > 80)
    slider_text.css('padding','80px 20px');
    }
    }
    doResponsive();
    $(window).resize(doResponsive);

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.