Code Monkey home page Code Monkey logo

bs-breakpoints's Issues

Get actual breakpoints from defined BS4 css custom properties.

Is code getting actual breakpoints also from defined BS4 CSS custom properties? It seems they are only hardcoded inside script? Or I'm wrong?
Of course, values of breakpoints may vary from project to project. So the definition in the script would then have to be changed.
As you know, there are available CSS custom properties from which the current breakpoints values can be read:

:root {
...
    --breakpoint-xs: 0;
    --breakpoint-sm: 576px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 992px;
    --breakpoint-xl: 1200px;
...
}

What do you think?

Discussion o about this twbs/bootstrap#25124 (comment)

bsBreakpoint is not defined

Hello @Johann-S !

I tried to install your library to my BS4 project without success. I use laravel mix (webpack based) compilation.

All my js files:
image
becomes one another big app-landing.js file
image
that I include before </body>:

...
        </main>

        <!-- Bootstrap core JavaScript
        ================================================== -->
        <script src="{{ mix('landing/js/app-landing.js') }}"></script>
    </body>
</html>

app-landing.js (1st image) content:

require('./bootstrap');
require('./custom');

In bootstrap.js file I put your library line. Full file content:

try {
    window.$ = window.jQuery = require('jquery');
    require('bootstrap');
    //!!!here
    require('bs-breakpoints');
    require('jquery.easing');

    //lg
    require('lightgallery');
    require('lg-zoom');

    //fontawesome
    require('./fontawesome');
} catch (e) {}

And in custom.js I put two lines:

...
//all loaded
$(document).ready(function() {
    console.log('loaded');
    bsBreakpoints.init();
    console.log(bsBreakpoints);
...

Finally in console:
image

What I'm doing wrong?

p.s. https://github.com/sachinchoolur/lightGallery library works fine in same situation.

Conditional

How to use this with conditional?

Ex. if( bsBreakpoints() == "xs" ) { // do something } else { // do something }

Thanks

Doesn't work with Bootstrap 5

Bootstrap 5 adds the bs- prefix by default, turning properties like --breakpoint-sm into --bs-breakpoint-sm.
To not lose BS4 support I recommend checking if the --breakpoint-sm formatted property names return NaN, and then attempting to get the prefixed ones.

See my PR #36

init.bs.breakpoint not working under iOS 7.1.2

Hi I ran the following jQuery code under Safari on an iPhone 4 with iOS 7.1.2:

$(window).on('init.bs.breakpoint', function (e) {
alert('init ' + e.breakpoint);
})

e.breakpoint ended up being null.

Do you know is bs-breakpoints works under iOS 7 or do you know what the issue may be?

Usage with jQuery

Hey thanks for the plugin - this looks great but I'm struggling to use it properly with jQuery

I can see the breakpoint if I query it like so:
console.log($.Event(bsBreakpoints.getCurrentBreakpoint()).type);

but reading your documentation I believe I should be able to access the breakpoint type on change by default? Could you please provide an example of the following:

"when breakpoint type changes fire XXX"

I could put it within a wrapper like: $(window).on('load resize scroll', function () { }
But I believe this has already been taken care of so not the correct way to handle it?

Not Working in IE 11

Bs-breakpoint is returning undefined in IE 11 although it is returning correct value in chrome

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.